lkml.org 
[lkml]   [2023]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [f2fs-dev] [PATCH] f2fs: get out of a repeat loop when getting a locked data page
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?

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.

Maybe we can loop MM guys to check whether below folio_file_page() may return
page which has different mapping?

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);
> }

\
 
 \ /
  Last update: 2023-03-27 01:17    [W:0.458 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site