Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

f2fs: fix wrong error injection path in inc_valid_block_count()

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: 36b877af7992 ("f2fs: Keep alloc_valid_block_count in sync")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>

authored by

Chao Yu and committed by
Jaegeuk Kim
9ea2f0be 052a82d8

+2 -1
+2 -1
fs/f2fs/f2fs.h
··· 1771 1771 if (time_to_inject(sbi, FAULT_BLOCK)) { 1772 1772 f2fs_show_injection_info(FAULT_BLOCK); 1773 1773 release = *count; 1774 - goto enospc; 1774 + goto release_quota; 1775 1775 } 1776 1776 1777 1777 /* ··· 1816 1816 1817 1817 enospc: 1818 1818 percpu_counter_sub(&sbi->alloc_valid_block_count, release); 1819 + release_quota: 1819 1820 dquot_release_reservation_block(inode, release); 1820 1821 return -ENOSPC; 1821 1822 }