Whamcloud - gitweb
Branch b1_6
authoryangsheng <yangsheng>
Fri, 3 Apr 2009 05:45:51 +0000 (05:45 +0000)
committeryangsheng <yangsheng>
Fri, 3 Apr 2009 05:45:51 +0000 (05:45 +0000)
b=18810

i=alex, johann

Fix race between read_block_bitmap() and mark_diskspace_used().

ldiskfs/kernel_patches/patches/ext3-fix-race-mb-clear-bits.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel5.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-sles10.series

diff --git a/ldiskfs/kernel_patches/patches/ext3-fix-race-mb-clear-bits.patch b/ldiskfs/kernel_patches/patches/ext3-fix-race-mb-clear-bits.patch
new file mode 100644 (file)
index 0000000..63fa89b
--- /dev/null
@@ -0,0 +1,41 @@
+Index: linux-2.6.16.60-0.31/fs/ext3/mballoc.c
+===================================================================
+--- linux-2.6.16.60-0.31.orig/fs/ext3/mballoc.c
++++ linux-2.6.16.60-0.31/fs/ext3/mballoc.c
+@@ -1170,7 +1170,10 @@ static inline void mb_clear_bits(spinloc
+                       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++;
+       }
+ }
+@@ -1188,7 +1191,10 @@ static inline void mb_set_bits(spinlock_
+                       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++;
+       }
+ }
+@@ -2974,10 +2980,9 @@ int ext3_mb_mark_diskspace_used(struct e
+               }
+       }
+ #endif
+-      mb_set_bits(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group), bitmap_bh->b_data,
+-                  ac->ac_b_ex.fe_start, ac->ac_b_ex.fe_len);
+-
+       spin_lock(sb_bgl_lock(sbi, ac->ac_b_ex.fe_group));
++      mb_set_bits(NULL, bitmap_bh->b_data, ac->ac_b_ex.fe_start,
++                  ac->ac_b_ex.fe_len);
+       if (gdp->bg_flags & cpu_to_le16(EXT3_BG_BLOCK_UNINIT)) {
+               gdp->bg_flags &= cpu_to_le16(~EXT3_BG_BLOCK_UNINIT);
+               gdp->bg_free_blocks_count =
index 330b52e..3ccbb49 100644 (file)
@@ -26,3 +26,4 @@ ext3-xattr-no-update-ctime-2.6.22-vanilla.patch
 ext3-journal-chksum-2.6.18-vanilla.patch
 ext3-get-raid-stripe-from-sb.patch
 ext3-big-endian-check-2.6-rhel5.patch
+ext3-fix-race-mb-clear-bits.patch
index c6934bb..9d88798 100644 (file)
@@ -31,3 +31,4 @@ ext3-check-bad-inode.patch
 ext3-journal-chksum-2.6.18-vanilla.patch
 ext3-get-raid-stripe-from-sb.patch
 ext3-big-endian-check-2.6-sles10.patch
+ext3-fix-race-mb-clear-bits.patch