]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode
authorChao Yu <chao@kernel.org>
Fri, 12 Jan 2024 19:41:30 +0000 (03:41 +0800)
committerSasha Levin <sashal@kernel.org>
Tue, 26 Mar 2024 22:20:00 +0000 (18:20 -0400)
commitbc1e39928c26df9e628f756398017e123827b976
treed6367178c83c02d41bd1d1f09fa93f9b7542e533
parenteb6d30bca0f23a4cc1d1f342d016e563c13a9b6c
f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode

[ Upstream commit 54607494875edd636aff3c21ace3ad9a7da758a9 ]

In reserve_compress_blocks(), we update blkaddrs of dnode in prior to
inc_valid_block_count(), it may cause inconsistent status bewteen
i_blocks and blkaddrs once inc_valid_block_count() fails.

To fix this issue, it needs to reverse their invoking order.

Fixes: c75488fb4d82 ("f2fs: introduce F2FS_IOC_RESERVE_COMPRESS_BLOCKS")
Reviewed-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/segment.c