From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: willy@infradead.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH] f2fs: get out of a repeat loop when getting a locked data page
Date: Mon, 27 Mar 2023 08:30:33 -0700 [thread overview]
Message-ID: <ZCG2mfviZfY1dqb4@google.com> (raw)
In-Reply-To: <8aea02b0-86f9-539a-02e9-27b381e68b66@kernel.org>
On 03/26, Chao Yu wrote:
> On 2023/3/24 5:39, Jaegeuk Kim wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=216050
> >
> > Somehow we're getting a page which has a different mapping.
> > Let's avoid the infinite loop.
> >
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> > fs/f2fs/data.c | 8 ++------
> > 1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index bf51e6e4eb64..80702c93e885 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -1329,18 +1329,14 @@ struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,
> > {
> > struct address_space *mapping = inode->i_mapping;
> > struct page *page;
> > -repeat:
> > +
> > page = f2fs_get_read_data_page(inode, index, 0, for_write, NULL);
> > if (IS_ERR(page))
> > return page;
> > /* wait for read completion */
> > lock_page(page);
> > - if (unlikely(page->mapping != mapping)) {
>
> How about using such logic only for move_data_page() to limit affect for
> other paths?
Why move_data_page() only? If this happens, we'll fall into a loop in anywhere?
>
> Jaegeuk, any thoughts about why mapping is mismatch in between page's one and
> inode->i_mapping?
>
> After several times code review, I didn't get any clue about why f2fs always
> get the different mapping in a loop.
I couldn't find the path to happen this. So weird. Please check the history in the
bug.
>
> Maybe we can loop MM guys to check whether below folio_file_page() may return
> page which has different mapping?
Matthew may have some idea on this?
>
> struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
> int fgp_flags, gfp_t gfp)
> {
> struct folio *folio;
>
> folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
> if (IS_ERR(folio))
> return NULL;
> return folio_file_page(folio, index);
> }
>
> Thanks,
>
> > - f2fs_put_page(page, 1);
> > - goto repeat;
> > - }
> > - if (unlikely(!PageUptodate(page))) {
> > + if (unlikely(page->mapping != mapping || !PageUptodate(page))) {
> > f2fs_put_page(page, 1);
> > return ERR_PTR(-EIO);
> > }
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
WARNING: multiple messages have this Message-ID (diff)
From: Jaegeuk Kim <jaegeuk@kernel.org>
To: Chao Yu <chao@kernel.org>
Cc: linux-kernel@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net, stable@vger.kernel.org,
willy@infradead.org
Subject: Re: [f2fs-dev] [PATCH] f2fs: get out of a repeat loop when getting a locked data page
Date: Mon, 27 Mar 2023 08:30:33 -0700 [thread overview]
Message-ID: <ZCG2mfviZfY1dqb4@google.com> (raw)
In-Reply-To: <8aea02b0-86f9-539a-02e9-27b381e68b66@kernel.org>
On 03/26, Chao Yu wrote:
> On 2023/3/24 5:39, Jaegeuk Kim wrote:
> > https://bugzilla.kernel.org/show_bug.cgi?id=216050
> >
> > Somehow we're getting a page which has a different mapping.
> > Let's avoid the infinite loop.
> >
> > Cc: <stable@vger.kernel.org>
> > Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
> > ---
> > fs/f2fs/data.c | 8 ++------
> > 1 file changed, 2 insertions(+), 6 deletions(-)
> >
> > diff --git a/fs/f2fs/data.c b/fs/f2fs/data.c
> > index bf51e6e4eb64..80702c93e885 100644
> > --- a/fs/f2fs/data.c
> > +++ b/fs/f2fs/data.c
> > @@ -1329,18 +1329,14 @@ struct page *f2fs_get_lock_data_page(struct inode *inode, pgoff_t index,
> > {
> > struct address_space *mapping = inode->i_mapping;
> > struct page *page;
> > -repeat:
> > +
> > page = f2fs_get_read_data_page(inode, index, 0, for_write, NULL);
> > if (IS_ERR(page))
> > return page;
> > /* wait for read completion */
> > lock_page(page);
> > - if (unlikely(page->mapping != mapping)) {
>
> How about using such logic only for move_data_page() to limit affect for
> other paths?
Why move_data_page() only? If this happens, we'll fall into a loop in anywhere?
>
> Jaegeuk, any thoughts about why mapping is mismatch in between page's one and
> inode->i_mapping?
>
> After several times code review, I didn't get any clue about why f2fs always
> get the different mapping in a loop.
I couldn't find the path to happen this. So weird. Please check the history in the
bug.
>
> Maybe we can loop MM guys to check whether below folio_file_page() may return
> page which has different mapping?
Matthew may have some idea on this?
>
> struct page *pagecache_get_page(struct address_space *mapping, pgoff_t index,
> int fgp_flags, gfp_t gfp)
> {
> struct folio *folio;
>
> folio = __filemap_get_folio(mapping, index, fgp_flags, gfp);
> if (IS_ERR(folio))
> return NULL;
> return folio_file_page(folio, index);
> }
>
> Thanks,
>
> > - f2fs_put_page(page, 1);
> > - goto repeat;
> > - }
> > - if (unlikely(!PageUptodate(page))) {
> > + if (unlikely(page->mapping != mapping || !PageUptodate(page))) {
> > f2fs_put_page(page, 1);
> > return ERR_PTR(-EIO);
> > }
next prev parent reply other threads:[~2023-03-27 15:30 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-23 21:39 [f2fs-dev] [PATCH] f2fs: get out of a repeat loop when getting a locked data page Jaegeuk Kim
2023-03-23 21:39 ` Jaegeuk Kim
2023-03-26 13:47 ` [f2fs-dev] " Chao Yu
2023-03-26 13:47 ` Chao Yu
2023-03-27 15:30 ` Jaegeuk Kim [this message]
2023-03-27 15:30 ` Jaegeuk Kim
2023-03-27 16:22 ` Matthew Wilcox
2023-03-27 16:22 ` Matthew Wilcox
2023-04-05 16:39 ` Jaegeuk Kim
2023-04-05 16:39 ` Jaegeuk Kim
2023-04-05 20:47 ` Jaegeuk Kim
2023-04-05 20:47 ` Jaegeuk Kim
2023-04-06 1:50 ` Chao Yu
2023-04-06 1:50 ` Chao Yu
2023-04-06 3:18 ` Jaegeuk Kim
2023-04-06 3:18 ` Jaegeuk Kim
2023-04-10 9:57 ` Chao Yu
2023-04-10 9:57 ` Chao Yu
2023-04-10 23:24 ` Jaegeuk Kim
2023-04-10 23:24 ` Jaegeuk Kim
2023-04-11 8:49 ` Chao Yu
2023-04-11 8:49 ` Chao Yu
2023-03-30 13:23 ` Chao Yu
2023-03-30 13:23 ` Chao Yu
2023-07-17 17:34 ` patchwork-bot+f2fs
2023-07-17 17:34 ` patchwork-bot+f2fs
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=ZCG2mfviZfY1dqb4@google.com \
--to=jaegeuk@kernel.org \
--cc=chao@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=willy@infradead.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.