Skip to content

Commit

Permalink
f2fs: fix wrong error injection path in inc_valid_block_count()
Browse files Browse the repository at this point in the history
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: 36b877a ("f2fs: Keep alloc_valid_block_count in sync")
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Chao Yu authored and Jaegeuk Kim committed Sep 6, 2019
1 parent 052a82d commit 9ea2f0b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion fs/f2fs/f2fs.h
Original file line number Diff line number Diff line change
Expand Up @@ -1771,7 +1771,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;
}

/*
Expand Down Expand Up @@ -1816,6 +1816,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;
}
Expand Down

0 comments on commit 9ea2f0b

Please sign in to comment.