mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
f2fs: fix wrong error injection path in inc_valid_block_count()
[ Upstream commit9ea2f0be6c] If FAULT_BLOCK type error injection is on, in inc_valid_block_count() we may decrease sbi->alloc_valid_block_count percpu stat count incorrectly, fix it. Fixes:36b877af79("f2fs: Keep alloc_valid_block_count in sync") Signed-off-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
f358f6210d
commit
d5856e1b8e
@@ -1701,7 +1701,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
|
||||
if (time_to_inject(sbi, FAULT_BLOCK)) {
|
||||
f2fs_show_injection_info(FAULT_BLOCK);
|
||||
release = *count;
|
||||
goto enospc;
|
||||
goto release_quota;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1741,6 +1741,7 @@ static inline int inc_valid_block_count(struct f2fs_sb_info *sbi,
|
||||
|
||||
enospc:
|
||||
percpu_counter_sub(&sbi->alloc_valid_block_count, release);
|
||||
release_quota:
|
||||
dquot_release_reservation_block(inode, release);
|
||||
return -ENOSPC;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user