From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jens Axboe <axboe@kernel.dk>, Arnd Bergmann <arnd@arndb.de>,
Yang Shi <shy828301@gmail.com>
Cc: Ajay Garg <ajaygargnsit@gmail.com>,
Hugh Dickins <hughd@google.com>,
Andrew Morton <akpm@linux-foundation.org>,
Linux-MM <linux-mm@kvack.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mm: shmem: do not call PageHWPoison on a ERR-page
Date: Sat, 13 Nov 2021 12:23:30 -0800 [thread overview]
Message-ID: <CAHk-=wh2fa20a-qe+8q8no3_2MD-DokXvKNDhDC6qMJyCTvnPw@mail.gmail.com> (raw)
In-Reply-To: <CAHk-=wjgZVY-skWP1vW2Cw+His+3eESATM_+QDYp=wFEsVv=qw@mail.gmail.com>
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
next prev parent reply other threads:[~2021-11-13 20:23 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-11 8:46 Ajay Garg
2021-11-11 11:06 ` Muchun Song
2021-11-11 11:40 ` Ajay Garg
2021-11-11 12:11 ` Muchun Song
2021-11-11 12:21 ` Ajay Garg
2021-11-11 13:09 ` Muchun Song
2021-11-11 18:42 ` Yang Shi
2021-11-11 17:45 ` Ajay Garg
2021-11-11 17:59 ` Jens Axboe
2021-11-13 17:21 ` Jens Axboe
2021-11-13 20:16 ` Linus Torvalds
2021-11-13 20:21 ` Jens Axboe
2021-11-13 20:23 ` Linus Torvalds [this message]
2021-11-13 22:29 ` Yang Shi
2021-11-13 22:58 ` Linus Torvalds
2021-11-14 3:10 ` Yang Shi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAHk-=wh2fa20a-qe+8q8no3_2MD-DokXvKNDhDC6qMJyCTvnPw@mail.gmail.com' \
--to=torvalds@linux-foundation.org \
--cc=ajaygargnsit@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=arnd@arndb.de \
--cc=axboe@kernel.dk \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shy828301@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox