Whamcloud - gitweb
LU-2555 ldiskfs: fix ext4_mb_add_n_trim()
authorNiu Yawei <niu@whamcloud.com>
Sun, 6 Jan 2013 05:16:36 +0000 (00:16 -0500)
committerOleg Drokin <green@whamcloud.com>
Sat, 26 Jan 2013 03:36:26 +0000 (22:36 -0500)
In ext4_mb_add_n_trim(), lg_prealloc_lock should be taken
when changing the lg_prealloc_list.

Signed-off-by: Niu Yawei <yawei.niu@intel.com>
Change-Id: Icc62d87a682b0ebf70ad12e148a52b864bf1fdb8
Reviewed-on: http://review.whamcloud.com/4961
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Tested-by: Hudson
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
ldiskfs/kernel_patches/patches/ext4-fix-ext4_mb_add_n_trim.patch [new file with mode: 0644]
ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series
ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series

diff --git a/ldiskfs/kernel_patches/patches/ext4-fix-ext4_mb_add_n_trim.patch b/ldiskfs/kernel_patches/patches/ext4-fix-ext4_mb_add_n_trim.patch
new file mode 100644 (file)
index 0000000..a394e18
--- /dev/null
@@ -0,0 +1,22 @@
+Index: linux-stage/fs/ext4/mballoc.c
+===================================================================
+--- linux-stage.orig/fs/ext4/mballoc.c
++++ linux-stage/fs/ext4/mballoc.c
+@@ -4352,7 +4352,7 @@ static void ext4_mb_add_n_trim(struct ex
+               /* The max size of hash table is PREALLOC_TB_SIZE */
+               order = PREALLOC_TB_SIZE - 1;
+       /* Add the prealloc space to lg */
+-      rcu_read_lock();
++      spin_lock(&lg->lg_prealloc_lock);
+       list_for_each_entry_rcu(tmp_pa, &lg->lg_prealloc_list[order],
+                                               pa_inode_list) {
+               spin_lock(&tmp_pa->pa_lock);
+@@ -4376,7 +4376,7 @@ static void ext4_mb_add_n_trim(struct ex
+       if (!added)
+               list_add_tail_rcu(&pa->pa_inode_list,
+                                       &lg->lg_prealloc_list[order]);
+-      rcu_read_unlock();
++      spin_unlock(&lg->lg_prealloc_lock);
+
+       /* Now trim the list to be not more than 8 elements */
+       if (lg_prealloc_count > 8) {
index 261528a..8f2d401 100644 (file)
@@ -39,3 +39,4 @@ ext4-quota-dont-update-cmtime.patch
 ext4-quota-first-class.patch
 ext4-inode_info_reorganize.patch
 ext4-fix-mbgroups-access.patch 
+ext4-fix-ext4_mb_add_n_trim.patch
index 61a1d5d..4b0e293 100644 (file)
@@ -39,3 +39,4 @@ ext4_pdirop-rhel6.patch
 ext4-quota-force-block-alloc-quotaoff.patch
 ext4-quota-dont-update-cmtime.patch
 ext4-quota-first-class.patch
+ext4-fix-ext4_mb_add_n_trim.patch