lkml.org 
[lkml]   [2021]   [Nov]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH] mm: shmem: do not call PageHWPoison on a ERR-page
On Sat, Nov 13, 2021 at 12:16 PM Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> Neither of the fixes were sent to me, and honestly, I think the real
> issue is that the original commit is just too broken for words.

Side note: the one you pointed to (by Ajay), had the comment that it
could be done differently as an optimization.

And I very much agree with that, although I think it would be a lot
more than an optimization: just doing

if (error)
return ERR_PTR(error);

earlier in the function would have avoided the issue entirely, and
would have made the code a lot easier to read too.

But what made me decide to just revert it entirely was that the
original commit that caused this all also had stuff like this:

- return shmem_getpage(inode, index, pagep, SGP_WRITE);
+ ret = shmem_getpage(inode, index, pagep, SGP_WRITE);
+
+ if (*pagep && PageHWPoison(*pagep)) {
+ unlock_page(*pagep);
+ put_page(*pagep);
+ ret = -EIO;
+ }
+
+ return ret;

which is another example of exactly the same issue: ignoring errors,
and then acting on other information and creating new errors.

Again, that code should have checked and handled errors first, and
then - if there wasn't an error - added that new HWpoison handling.

So that just made me go "this is not worth fixing up, this just needs
re-doing", and thus I just went for the revert instead.

Linus

\
 
 \ /
  Last update: 2021-11-13 21:27    [W:0.071 / U:0.204 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site