> Ok the changes was not done for this purpose. I need to make sure we > update bitmap and clear group_desc uninit flag after taking sb_bgl_lock > That means when we claim blocks we can't use mb_set_bits with > sb_bgl_lock because we would already be holding it. How about the below > change > > diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c > index 444ad99..53180b1 100644 > --- a/fs/ext4/mballoc.c > +++ b/fs/ext4/mballoc.c > @@ -1031,7 +1031,10 @@ static void mb_clear_bits(spinlock_t *lock, void *bm, int cur, int len) > cur += 32; > continue; > } > - mb_clear_bit_atomic(lock, cur, bm); > + if (lock) > + mb_clear_bit_atomic(lock, cur, bm); > + else > + mb_clear_bit(cur, bm); > cur++; > } > } > @@ -1049,7 +1052,10 @@ static void mb_set_bits(spinlock_t *lock, void *bm, int cur, int len) > cur += 32; > continue; > } > - mb_set_bit_atomic(lock, cur, bm); > + if (lock) > + mb_set_bit_atomic(lock, cur, bm); > + else > + mb_set_bit(cur, bm); > cur++; > } > } Aneesh, I've just tried your patch on top of the patch queue and I still have this error when I resize the fs while allocating blocks concurrently (with dd): EXT4-fs error (device md0): ext4_mb_mark_diskspace_used: Allocating block in system zone - block = 9117697 EXT4-fs error (device md0): ext4_mb_generate_buddy: EXT4-fs: group 1113: 6144 blocks in bitmap, 6014 in gd Anyway I'm not sure if it is related to the race you try to fix. FYI this error first appeared with the first set of patches concerning resize and mballoc. Regards, Frederic -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html