mirror of
https://github.com/torvalds/linux.git
synced 2026-07-27 17:47:41 +02:00
f2fs: reject setattr size changes on large folio files
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: 05e65c14ea ("f2fs: support large folio for immutable non-compressed case")
Signed-off-by: Wenjie Qi <qiwenjie@xiaomi.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
90e02a8e1b
commit
242d30bfc0
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user