f2fs: fix to check return value of inc_valid_block_count()
authorChao Yu <chao@kernel.org>
Wed, 5 Apr 2023 14:45:36 +0000 (22:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:23 +0000 (23:03 +0900)
commitdf6222b01f5307711778cb54b36e66014a6d740a
tree4eb9f5e2315907391892d0741418ae9f8e9c38f9
parent2eb5d0165b3691702ede7baaff2c21cfc7bb01f9
f2fs: fix to check return value of inc_valid_block_count()

[ Upstream commit 935fc6fa6466cf18dd72dd1518ebc7bfc4cd58a4 ]

In __replace_atomic_write_block(), we missed to check return value
of inc_valid_block_count(), for extreme testcase that f2fs image is
run out of space, it may cause inconsistent status in between SIT
table and total valid block count.

Cc: Daeho Jeong <daehojeong@google.com>
Fixes: 3db1de0e582c ("f2fs: change the current atomic write way")
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/segment.c