From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: Chao Yu <chao@kernel.org>, Jaegeuk Kim <jaegeuk@kernel.org>,
Sunmin Jeong <s_min.jeong@samsung.com>
Cc: Zhan Xusheng <zhanxusheng@xiaomi.com>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
linux-f2fs-devel@lists.sourceforge.net,
Sungjong Seo <sj1557.seo@samsung.com>
Subject: Re: [f2fs-dev] [PATCH] f2fs: fix i_size when pinned fallocate partially fails
Date: Mon, 17 Aug 2026 13:08:52 +0800 [thread overview]
Message-ID: <20260817050853.3437985-1-zhanxusheng@xiaomi.com> (raw)
In-Reply-To: <c3a4a131-4a97-4227-8968-03fcd491c0a4@kernel.org>
On 8/17/26 11:12, Chao Yu wrote:
> Can you please provide a reproducer?
It needs a start offset that is not section aligned, plus a fallocate that
hits ENOSPC partway so the error path runs with expanded > 0.
truncate -s 80M img
mkfs.f2fs -s 1 -f img # 2 MiB sections, sec_blks = 512
mount -o loop img /mnt
touch /mnt/pinned
f2fs_io pinfile set /mnt/pinned
# 2093056 = block 511, so pg_start % sec_blks = 511
f2fs_io fallocate 0 2093056 536870912 /mnt/pinned
stat -c %s /mnt/pinned
filefrag -v /mnt/pinned
7.2, last extent and i_size:
ext: logical_offset: length: flags:
2: 5120.. 10737: 5618: last,merged
i_size=46075904
i_size block 11249, allocated through 10738, overshoot 511
With this patch:
ext: logical_offset: length: flags:
2: 5120.. 10737: 5618: last,merged,eof
i_size=43982848
i_size block 10738, allocated through 10738, overshoot 0
filefrag prints eof only once the last extent reaches i_size, so its
absence in the first run shows the mismatch on its own.
7.0, before 4275b59673eb, also gives overshoot 0. Absolute block numbers
differ there because the start rounding changes how much fits before
ENOSPC, so only the overshoot compares across the three.
I will add this to the changelog in v2.
Thanks,
Zhan Xusheng
_______________________________________________
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: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: Chao Yu <chao@kernel.org>, Jaegeuk Kim <jaegeuk@kernel.org>,
Sunmin Jeong <s_min.jeong@samsung.com>
Cc: Zhan Xusheng <zhanxusheng@xiaomi.com>,
Sungjong Seo <sj1557.seo@samsung.com>,
Yeongjin Gil <youngjin.gil@samsung.com>,
Yunji Kang <yunji0.kang@samsung.com>,
linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH] f2fs: fix i_size when pinned fallocate partially fails
Date: Mon, 17 Aug 2026 13:08:52 +0800 [thread overview]
Message-ID: <20260817050853.3437985-1-zhanxusheng@xiaomi.com> (raw)
In-Reply-To: <c3a4a131-4a97-4227-8968-03fcd491c0a4@kernel.org>
On 8/17/26 11:12, Chao Yu wrote:
> Can you please provide a reproducer?
It needs a start offset that is not section aligned, plus a fallocate that
hits ENOSPC partway so the error path runs with expanded > 0.
truncate -s 80M img
mkfs.f2fs -s 1 -f img # 2 MiB sections, sec_blks = 512
mount -o loop img /mnt
touch /mnt/pinned
f2fs_io pinfile set /mnt/pinned
# 2093056 = block 511, so pg_start % sec_blks = 511
f2fs_io fallocate 0 2093056 536870912 /mnt/pinned
stat -c %s /mnt/pinned
filefrag -v /mnt/pinned
7.2, last extent and i_size:
ext: logical_offset: length: flags:
2: 5120.. 10737: 5618: last,merged
i_size=46075904
i_size block 11249, allocated through 10738, overshoot 511
With this patch:
ext: logical_offset: length: flags:
2: 5120.. 10737: 5618: last,merged,eof
i_size=43982848
i_size block 10738, allocated through 10738, overshoot 0
filefrag prints eof only once the last extent reaches i_size, so its
absence in the first run shows the mismatch on its own.
7.0, before 4275b59673eb, also gives overshoot 0. Absolute block numbers
differ there because the start rounding changes how much fits before
ENOSPC, so only the overshoot compares across the three.
I will add this to the changelog in v2.
Thanks,
Zhan Xusheng
next prev parent reply other threads:[~2026-08-17 5:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-17 2:27 [PATCH] f2fs: fix i_size when pinned fallocate partially fails Zhan Xusheng
2026-08-17 2:27 ` [f2fs-dev] " Zhan Xusheng
2026-08-17 3:12 ` Chao Yu via Linux-f2fs-devel
2026-08-17 3:12 ` Chao Yu
2026-08-17 5:08 ` Zhan Xusheng [this message]
2026-08-17 5:08 ` Zhan Xusheng
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=20260817050853.3437985-1-zhanxusheng@xiaomi.com \
--to=zhanxusheng1024@gmail.com \
--cc=chao@kernel.org \
--cc=jaegeuk@kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--cc=linux-kernel@vger.kernel.org \
--cc=s_min.jeong@samsung.com \
--cc=sj1557.seo@samsung.com \
--cc=stable@vger.kernel.org \
--cc=zhanxusheng@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 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.