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)
committerJaegeuk Kim <jaegeuk@kernel.org>
Tue, 6 Feb 2024 02:58:39 +0000 (18:58 -0800)
commit54607494875edd636aff3c21ace3ad9a7da758a9
tree63a31874c3c3c44d53514a6e237831df92203060
parenteb8fbaa53374e0a2d4381190abfe708481517bbb
f2fs: compress: fix to avoid inconsistence bewteen i_blocks and dnode

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>
fs/f2fs/data.c
fs/f2fs/f2fs.h
fs/f2fs/file.c
fs/f2fs/segment.c