[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230425164711.19826-1-frank.li@vivo.com>
Date: Wed, 26 Apr 2023 00:47:11 +0800
From: Yangtao Li <frank.li@...o.com>
To: Jaegeuk Kim <jaegeuk@...nel.org>, Chao Yu <chao@...nel.org>,
Daeho Jeong <daehojeong@...gle.com>
Cc: Yangtao Li <frank.li@...o.com>, Qi Han <hanqi@...o.com>,
linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: [PATCH v2] f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED
If a file has FI_COMPRESS_RELEASED, all writes for it should not be
allowed.
Fixes: 5fdb322ff2c2 ("f2fs: add F2FS_IOC_DECOMPRESS_FILE and F2FS_IOC_COMPRESS_FILE")
Signed-off-by: Qi Han <hanqi@...o.com>
Signed-off-by: Yangtao Li <frank.li@...o.com>
---
fs/f2fs/file.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
index 5ac53d2627d2..46c62923f096 100644
--- a/fs/f2fs/file.c
+++ b/fs/f2fs/file.c
@@ -2593,6 +2593,11 @@ static int f2fs_defragment_range(struct f2fs_sb_info *sbi,
inode_lock(inode);
+ if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED)) {
+ inode_unlock(inode);
+ return -EINVAL;
+ }
+
/* if in-place-update policy is enabled, don't waste time here */
set_inode_flag(inode, FI_OPU_WRITE);
if (f2fs_should_update_inplace(inode, NULL)) {
--
2.39.0
Powered by blists - more mailing lists