ext4: lock block groups when initializing
I noticed when filling a 1T filesystem with 4 threads using the fs_mark benchmark: fs_mark -d /mnt/test -D 256 -n 100000 -t 4 -s 20480 -F -S 0 that I occasionally got checksum mismatch errors: EXT4-fs error (device sdb): ext4_init_inode_bitmap: Checksum bad for group 6935 etc. I'd reliably get 4-5 of them during the run. It appears that the problem is likely a race to init the bg's when the uninit_bg feature is enabled. With the patch below, which adds sb_bgl_locking around initialization, I was able to complete several runs with no errors or warnings. Signed-off-by: Eric Sandeen <sandeen@redhat.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
This commit is contained in:
committed by
Theodore Ts'o
parent
e29d1cde63
commit
b5f10eed81
@ -787,13 +787,16 @@ static int ext4_mb_init_cache(struct page *page, char *incore)
|
||||
if (bh_uptodate_or_lock(bh[i]))
|
||||
continue;
|
||||
|
||||
spin_lock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
|
||||
if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) {
|
||||
ext4_init_block_bitmap(sb, bh[i],
|
||||
first_group + i, desc);
|
||||
set_buffer_uptodate(bh[i]);
|
||||
unlock_buffer(bh[i]);
|
||||
spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
|
||||
continue;
|
||||
}
|
||||
spin_unlock(sb_bgl_lock(EXT4_SB(sb), first_group + i));
|
||||
get_bh(bh[i]);
|
||||
bh[i]->b_end_io = end_buffer_read_sync;
|
||||
submit_bh(READ, bh[i]);
|
||||
|
Reference in New Issue
Block a user