[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wh2fa20a-qe+8q8no3_2MD-DokXvKNDhDC6qMJyCTvnPw@mail.gmail.com>
Date: Sat, 13 Nov 2021 12:23:30 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Jens Axboe <axboe@...nel.dk>, Arnd Bergmann <arnd@...db.de>,
Yang Shi <shy828301@...il.com>
Cc: Ajay Garg <ajaygargnsit@...il.com>,
Hugh Dickins <hughd@...gle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Linux-MM <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] mm: shmem: do not call PageHWPoison on a ERR-page
On Sat, Nov 13, 2021 at 12:16 PM Linus Torvalds
<torvalds@...ux-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
Powered by blists - more mailing lists