* [PATCH v2] f2fs: reject setattr size changes on large folio files
@ 2026-06-10 14:37 Wenjie Qi
2026-06-15 3:27 ` Chao Yu
2026-06-16 2:50 ` [f2fs-dev] " patchwork-bot+f2fs
0 siblings, 2 replies; 3+ messages in thread
From: Wenjie Qi @ 2026-06-10 14:37 UTC (permalink / raw)
To: jaegeuk, chao; +Cc: linux-f2fs-devel, linux-kernel, qiwenjie, qwjhust
F2FS large folios are only enabled for immutable non-compressed files.
Writable open and writable mmap reject such mappings, but truncate(2)
through f2fs_setattr() misses the same guard.
If FS_IMMUTABLE_FL is cleared while the inode is still cached, the mapping
can keep large-folio support and ATTR_SIZE can change i_size. Reject size
changes in that state.
Fixes: 05e65c14ea59 ("f2fs: support large folio for immutable non-compressed case")
Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
---
Changes in v2:
- Drop the obsolete user.fadvise/chmod part and keep only the ATTR_SIZE fix.
Tested with QEMU by clearing immutable on a cached large-folio file and
checking that truncate(2) now fails with EOPNOTSUPP.
fs/f2fs/file.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 6edf0105dbc8..80a64f0ff9d6 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -1098,6 +1098,8 @@ int f2fs_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
return -EPERM;
if ((attr->ia_valid & ATTR_SIZE)) {
+ if (mapping_large_folio_support(inode->i_mapping))
+ return -EOPNOTSUPP;
if (!f2fs_is_compress_backend_ready(inode) ||
IS_DEVICE_ALIASING(inode))
return -EOPNOTSUPP;
--
2.43.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] f2fs: reject setattr size changes on large folio files
2026-06-10 14:37 [PATCH v2] f2fs: reject setattr size changes on large folio files Wenjie Qi
@ 2026-06-15 3:27 ` Chao Yu
2026-06-16 2:50 ` [f2fs-dev] " patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: Chao Yu @ 2026-06-15 3:27 UTC (permalink / raw)
To: Wenjie Qi, jaegeuk; +Cc: chao, linux-f2fs-devel, linux-kernel, qiwenjie
On 6/10/26 22:37, Wenjie Qi wrote:
> F2FS large folios are only enabled for immutable non-compressed files.
> Writable open and writable mmap reject such mappings, but truncate(2)
> through f2fs_setattr() misses the same guard.
>
> If FS_IMMUTABLE_FL is cleared while the inode is still cached, the mapping
> can keep large-folio support and ATTR_SIZE can change i_size. Reject size
> changes in that state.
>
Cc: stable@kernel.org
> Fixes: 05e65c14ea59 ("f2fs: support large folio for immutable non-compressed case")
> Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Thanks,
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [f2fs-dev] [PATCH v2] f2fs: reject setattr size changes on large folio files
2026-06-10 14:37 [PATCH v2] f2fs: reject setattr size changes on large folio files Wenjie Qi
2026-06-15 3:27 ` Chao Yu
@ 2026-06-16 2:50 ` patchwork-bot+f2fs
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+f2fs @ 2026-06-16 2:50 UTC (permalink / raw)
To: Wenjie Qi; +Cc: jaegeuk, chao, qiwenjie, linux-kernel, linux-f2fs-devel
Hello:
This patch was applied to jaegeuk/f2fs.git (dev)
by Jaegeuk Kim <jaegeuk@kernel.org>:
On Wed, 10 Jun 2026 22:37:35 +0800 you wrote:
> F2FS large folios are only enabled for immutable non-compressed files.
> Writable open and writable mmap reject such mappings, but truncate(2)
> through f2fs_setattr() misses the same guard.
>
> If FS_IMMUTABLE_FL is cleared while the inode is still cached, the mapping
> can keep large-folio support and ATTR_SIZE can change i_size. Reject size
> changes in that state.
>
> [...]
Here is the summary with links:
- [f2fs-dev,v2] f2fs: reject setattr size changes on large folio files
https://git.kernel.org/jaegeuk/f2fs/c/831bece2d6e6
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-06-16 2:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-10 14:37 [PATCH v2] f2fs: reject setattr size changes on large folio files Wenjie Qi
2026-06-15 3:27 ` Chao Yu
2026-06-16 2:50 ` [f2fs-dev] " patchwork-bot+f2fs
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®