f2fs: avoid data race when deciding checkpoin in f2fs_sync_file
authorJaegeuk Kim <jaegeuk@kernel.org>
Wed, 20 Jul 2016 02:20:11 +0000 (19:20 -0700)
committerJaegeuk Kim <jaegeuk@kernel.org>
Wed, 20 Jul 2016 21:53:21 +0000 (14:53 -0700)
commitdd11a5df5219b4d3c4d3f38b9cae48c3518d3152
tree1146c8143ab7d871e45342d230a6050e5b45cc48
parent4dd6f977fc778e5a0da604e5f8cb2f36d163d27b
f2fs: avoid data race when deciding checkpoin in f2fs_sync_file

When fs utilization is almost full, f2fs_sync_file should do checkpoint if
there is not enough space for roll-forward later. (i.e. space_for_roll_forward)
So, currently we have no lock for sbi->alloc_valid_block_count, resulting in
race condition.

In rare case, we can get -ENOSPC when doing roll-forward which triggers

if (is_valid_blkaddr(sbi, dest, META_POR)) {
if (src == NULL_ADDR) {
err = reserve_new_block(&dn);
f2fs_bug_on(sbi, err);
...
}
...
}
in do_recover_data.

So, this patch avoids that situation in advance.

Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
fs/f2fs/f2fs.h
This page took 0.024271 seconds and 5 git commands to generate.