From: Chao Yu Date: Sun, 10 Dec 2023 11:35:44 +0000 (+0800) Subject: f2fs: fix to check compress file in f2fs_move_file_range() X-Git-Tag: v6.7.2~326 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=321bb4b1af5a9d5ab58f200a545d9d2917886cec;p=thirdparty%2Fkernel%2Fstable.git f2fs: fix to check compress file in f2fs_move_file_range() [ Upstream commit fb9b65340c818875ea86464faf3c744bdce0055c ] f2fs_move_file_range() doesn't support migrating compressed cluster data, let's add the missing check condition and return -EOPNOTSUPP for the case until we support it. Fixes: 4c8ff7095bef ("f2fs: support data compression") Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Sasha Levin --- diff --git a/fs/f2fs/file.c b/fs/f2fs/file.c index e50363583f019..37917c634e223 100644 --- a/fs/f2fs/file.c +++ b/fs/f2fs/file.c @@ -2818,6 +2818,11 @@ static int f2fs_move_file_range(struct file *file_in, loff_t pos_in, goto out; } + if (f2fs_compressed_file(src) || f2fs_compressed_file(dst)) { + ret = -EOPNOTSUPP; + goto out_unlock; + } + ret = -EINVAL; if (pos_in + len > src->i_size || pos_in + len < pos_in) goto out_unlock;