* [f2fs-dev] [PATCH] f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED
@ 2023-04-25 15:11 Yangtao Li via Linux-f2fs-devel
2023-04-27 9:38 ` Chao Yu
0 siblings, 1 reply; 2+ messages in thread
From: Yangtao Li via Linux-f2fs-devel @ 2023-04-25 15:11 UTC (permalink / raw)
To: Jaegeuk Kim, Chao Yu, Daeho Jeong
Cc: linux-f2fs-devel, Qi Han, linux-kernel, Yangtao Li
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@vivo.com>
Signed-off-by: Yangtao Li <frank.li@vivo.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;
+
if (copy_from_user(&range, (struct f2fs_defragment __user *)arg,
sizeof(range)))
return -EFAULT;
--
2.39.0
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [f2fs-dev] [PATCH] f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED
2023-04-25 15:11 [f2fs-dev] [PATCH] f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED Yangtao Li via Linux-f2fs-devel
@ 2023-04-27 9:38 ` Chao Yu
0 siblings, 0 replies; 2+ messages in thread
From: Chao Yu @ 2023-04-27 9:38 UTC (permalink / raw)
To: Yangtao Li, Jaegeuk Kim, Daeho Jeong
Cc: Qi Han, linux-kernel, linux-f2fs-devel
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@vivo.com>
> Signed-off-by: Yangtao Li <frank.li@vivo.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;
_______________________________________________
Linux-f2fs-devel mailing list
Linux-f2fs-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-04-27 9:38 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-04-25 15:11 [f2fs-dev] [PATCH] f2fs: do not allow to defragment files have FI_COMPRESS_RELEASED Yangtao Li via Linux-f2fs-devel
2023-04-27 9:38 ` Chao Yu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).