Whamcloud - gitweb
Branch b1_8
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext4-claim_inode-free_inode-race.patch
1 Index: linux-stage/fs/ext4/ialloc.c
2 ===================================================================
3 --- linux-stage.orig/fs/ext4/ialloc.c
4 +++ linux-stage/fs/ext4/ialloc.c
5 @@ -189,7 +189,7 @@ void ext4_free_inode(handle_t *handle, s
6         struct ext4_group_desc *gdp;
7         struct ext4_super_block *es;
8         struct ext4_sb_info *sbi;
9 -       int fatal = 0, err, count;
10 +       int fatal = 0, err, count, cleared;
11         ext4_group_t flex_group;
12  
13         if (atomic_read(&inode->i_count) > 1) {
14 @@ -243,9 +243,12 @@ void ext4_free_inode(handle_t *handle, s
15         if (fatal)
16                 goto error_return;
17  
18 +       ext4_lock_group(sb, block_group);
19 +       cleared = ext4_clear_bit(bit, bitmap_bh->b_data);
20 +       ext4_unlock_group(sb, block_group);
21 +
22         /* Ok, now we can actually update the inode bitmaps.. */
23 -       if (!ext4_clear_bit_atomic(ext4_group_lock_ptr(sb, block_group),
24 -                                  bit, bitmap_bh->b_data))
25 +       if (!cleared)
26                 ext4_error(sb, "ext4_free_inode",
27                            "bit already cleared for inode %lu", ino);
28         else {