]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: compress: relocate some judgments in f2fs_reserve_compress_blocks
authorXiuhong Wang <xiuhong.wang@unisoc.com>
Wed, 6 Mar 2024 03:47:45 +0000 (11:47 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:20:03 +0000 (18:20 -0400)
commit4d1a3b791c5dabdebc1b0e2b01ee643fb6223472
treecf7f445e94ae9aeb3562740d92269fb289dc2dc4
parentcda2f3d1754a36467cf6bd282df03180d54716c3
f2fs: compress: relocate some judgments in f2fs_reserve_compress_blocks

[ Upstream commit b7d797d241c154d73ec5523f87f3b06d4f299da1 ]

The following f2fs_io test will get a "0" result instead of -EINVAL,
unisoc # ./f2fs_io compress file
unisoc # ./f2fs_io reserve_cblocks file
 0
it's not reasonable, so the judgement of
atomic_read(&F2FS_I(inode)->i_compr_blocks) should be placed after
the judgement of is_inode_flag_set(inode, FI_COMPRESS_RELEASED).

Fixes: c75488fb4d82 ("f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS")
Signed-off-by: Xiuhong Wang <xiuhong.wang@unisoc.com>
Signed-off-by: Zhiguo Niu <zhiguo.niu@unisoc.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/file.c