Whamcloud - gitweb
b=19674
[fs/lustre-release.git] / ldiskfs / kernel_patches / patches / ext3-fix-race-mb-clear-bits.patch
1 Index: linux-2.6.16.60-0.31/fs/ext3/mballoc.c
2 ===================================================================
3 --- linux-2.6.16.60-0.31.orig/fs/ext3/mballoc.c
4 +++ linux-2.6.16.60-0.31/fs/ext3/mballoc.c
5 @@ -1170,7 +1170,10 @@ static inline void mb_clear_bits(spinloc
6                         cur += 32;
7                         continue;
8                 }
9 -               mb_clear_bit_atomic(lock, cur, bm);
10 +               if (lock)
11 +                       mb_clear_bit_atomic(lock, cur, bm);
12 +               else
13 +                       mb_clear_bit(cur, bm);
14                 cur++;
15         }
16  }
17 @@ -1188,7 +1191,10 @@ static inline void mb_set_bits(spinlock_
18                         cur += 32;
19                         continue;
20                 }
21 -               mb_set_bit_atomic(lock, cur, bm);
22 +               if (lock)
23 +                       mb_set_bit_atomic(lock, cur, bm);
24 +               else
25 +                       mb_set_bit(cur, bm);
26                 cur++;
27         }
28  }
29 @@ -2974,10 +2980,9 @@ int ext3_mb_mark_diskspace_used(struct e
30                 }
31         }
32  #endif
33 -       mb_set_bits(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group), bitmap_bh->b_data,
34 -                   ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
35 -
36         spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
37 +       mb_set_bits(NULL, bitmap_bh->b_data, ac->ac_b_ex.fe_start,
38 +                   ac->ac_b_ex.fe_len);
39         if (gdp->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
40                 gdp->bg_flags &= cpu_to_le16(~EXT3_BG_BLOCK_UNINIT);
41                 gdp->bg_free_blocks_count =