[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <626404fe-3547-979f-f483-b43416f6f88a@kernel.org>
Date: Thu, 27 Apr 2023 17:38:19 +0800
From: Chao Yu <chao@...nel.org>
To: Yangtao Li <frank.li@...o.com>, Jaegeuk Kim <jaegeuk@...nel.org>,
Daeho Jeong <daehojeong@...gle.com>
Cc: Qi Han <hanqi@...o.com>, linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] f2fs: do not allow to defragment files have
FI_COMPRESS_RELEASED
On 2023/4/25 23:11, Yangtao Li wrote:
> 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 | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c
> index 9c9c3f660e01..c21d6a829c4a 100644
> --- a/fs/f2fs/file.c
> +++ b/fs/f2fs/file.c
> @@ -2734,6 +2734,9 @@ static int f2fs_ioc_defragment(struct file *filp, unsigned long arg)
> if (f2fs_readonly(sbi->sb))
> return -EROFS;
>
> + if (is_inode_flag_set(inode, FI_COMPRESS_RELEASED))
> + return -EINVAL;
This flag should be checked w/ inode lock.
Thanks,
> +
> if (copy_from_user(&range, (struct f2fs_defragment __user *)arg,
> sizeof(range)))
> return -EFAULT;
Powered by blists - more mailing lists