From: Chao Yu via Linux-f2fs-devel <linux-f2fs-devel@lists.sourceforge.net>
To: Yongpeng Yang <monty_pavel@sina.com>, Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Yongpeng Yang <yangyongpeng@xiaomi.com>,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: [f2fs-dev] [PATCH v4 4/4] f2fs: fix inline data not being written to disk in writeback path
Date: Wed, 18 Mar 2026 12:35:39 +0800 [thread overview]
Message-ID: <21fe73ba-2476-443a-862d-6c415205932b@kernel.org> (raw)
In-Reply-To: <20260317115459.208306-8-monty_pavel@sina.com>
On 2026/3/17 19:56, Yongpeng Yang wrote:
> From: Yongpeng Yang <yangyongpeng@xiaomi.com>
>
> When f2fs_fiemap() is called with `fileinfo->fi_flags` containing the
> FIEMAP_FLAG_SYNC flag, it attempts to write data to disk before
> retrieving file mappings via filemap_write_and_wait(). However, there is
> an issue where the file does not get mapped as expected. The following
> scenario can occur:
>
> root@vm:/mnt/f2fs# dd if=/dev/zero of=data.3k bs=3k count=1
> root@vm:/mnt/f2fs# xfs_io data.3k -c "fiemap -v 0 4096"
> data.3k:
> EXT: FILE-OFFSET BLOCK-RANGE TOTAL FLAGS
> 0: [0..5]: 0..5 6 0x307
>
> The root cause of this issue is that f2fs_write_single_data_page() only
> calls f2fs_write_inline_data() to copy data from the data folio to the
> inode folio, and it clears the dirty flag on the data folio. However, it
> does not mark the data folio as writeback. When
> __filemap_fdatawait_range() checks for folios with the writeback flag,
> it returns early, causing f2fs_fiemap() to report that the file has no
> mapping.
>
> To fix this issue, the solution is to call
> f2fs_write_single_node_folio() in f2fs_inline_data_fiemap() when
> getting fiemap with FIEMAP_FLAG_SYNC flags. This patch ensures that the
> inode folio is written back and the writeback process completes before
> proceeding.
>
> Fixes: 9ffe0fb5f3bb ("f2fs: handle inline data operations")
> Signed-off-by: Yongpeng Yang <yangyongpeng@xiaomi.com>
> ---
> v4:
> - Fix the missing return value check for f2fs_get_inode_folio().
> v3:
> - Call f2fs_write_single_node_folio() instead of f2fs_sync_node_pages()
> v2:
> - Call f2fs_sync_node_pages() in getting fiemap path rather than
> writeback path.
> ---
> fs/f2fs/inline.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
Declaration should be relocated into this patch.
+int f2fs_write_single_node_folio(struct folio *node_folio, int sync_mode,
+ bool mark_dirty, enum iostat_type io_type);
Thanks,
> diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
> index 86d2abbb40ff..62a8a1192a41 100644
> --- a/fs/f2fs/inline.c
> +++ b/fs/f2fs/inline.c
> @@ -814,6 +814,15 @@ int f2fs_inline_data_fiemap(struct inode *inode,
> goto out;
> }
>
> + if (fieinfo->fi_flags & FIEMAP_FLAG_SYNC) {
> + err = f2fs_write_single_node_folio(ifolio, true, false, FS_NODE_IO);
> + if (err)
> + return err;
> + ifolio = f2fs_get_inode_folio(F2FS_I_SB(inode), inode->i_ino);
> + if (IS_ERR(ifolio))
> + return PTR_ERR(ifolio);
> + f2fs_folio_wait_writeback(ifolio, NODE, true, true);
> + }
> ilen = min_t(size_t, MAX_INLINE_DATA(inode), i_size_read(inode));
> if (start >= ilen)
> goto out;
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
next prev parent reply other threads:[~2026-03-18 4:35 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-17 11:54 [f2fs-dev] [PATCH v4 1/4] f2fs: refactor f2fs_move_node_folio function Yongpeng Yang
2026-03-17 11:54 ` [f2fs-dev] [PATCH v4 2/4] f2fs: refactor node footer flag setting related code Yongpeng Yang
2026-03-18 4:17 ` Chao Yu via Linux-f2fs-devel
2026-03-17 11:55 ` [f2fs-dev] [PATCH v4 3/4] f2fs: fix fsck inconsistency caused by FGGC of node block Yongpeng Yang
2026-03-18 4:26 ` Chao Yu via Linux-f2fs-devel
2026-03-17 11:56 ` [f2fs-dev] [PATCH v4 4/4] f2fs: fix inline data not being written to disk in writeback path Yongpeng Yang
2026-03-18 4:35 ` Chao Yu via Linux-f2fs-devel [this message]
2026-03-18 8:05 ` Yongpeng Yang
2026-03-18 4:15 ` [f2fs-dev] [PATCH v4 1/4] f2fs: refactor f2fs_move_node_folio function Chao Yu via Linux-f2fs-devel
2026-03-18 8:03 ` Yongpeng Yang
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=21fe73ba-2476-443a-862d-6c415205932b@kernel.org \
--to=linux-f2fs-devel@lists.sourceforge.net \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=monty_pavel@sina.com \
--cc=yangyongpeng@xiaomi.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