diff options
author | Eric Sandeen <sandeen@redhat.com> | 2008-08-02 21:21:08 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2008-08-02 21:21:08 -0400 |
commit | b5f10eed8125702929e57cca7e5956b1b9b6d015 (patch) | |
tree | e5b38a6f654baea3658bf100320a4d66387988a3 /fs/ext4/balloc.c | |
parent | e29d1cde63be0b5f1739416b5574a83c34bf8eeb (diff) | |
download | linux-3.10-b5f10eed8125702929e57cca7e5956b1b9b6d015.tar.gz linux-3.10-b5f10eed8125702929e57cca7e5956b1b9b6d015.tar.bz2 linux-3.10-b5f10eed8125702929e57cca7e5956b1b9b6d015.zip |
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>
Diffstat (limited to 'fs/ext4/balloc.c')
-rw-r--r-- | fs/ext4/balloc.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c index 386cb79ac4b..1ae5004e93f 100644 --- a/fs/ext4/balloc.c +++ b/fs/ext4/balloc.c @@ -321,12 +321,15 @@ ext4_read_block_bitmap(struct super_block *sb, ext4_group_t block_group) if (bh_uptodate_or_lock(bh)) return bh; + spin_lock(sb_bgl_lock(EXT4_SB(sb), block_group)); if (desc->bg_flags & cpu_to_le16(EXT4_BG_BLOCK_UNINIT)) { ext4_init_block_bitmap(sb, bh, block_group, desc); set_buffer_uptodate(bh); unlock_buffer(bh); + spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group)); return bh; } + spin_unlock(sb_bgl_lock(EXT4_SB(sb), block_group)); if (bh_submit_read(bh) < 0) { put_bh(bh); ext4_error(sb, __func__, |