From c0ed0c4a17fdb0c2978aa06183603394d509fb28 Mon Sep 17 00:00:00 2001 From: Niu Yawei Date: Sun, 6 Jan 2013 00:16:36 -0500 Subject: [PATCH] LU-2555 ldiskfs: fix ext4_mb_add_n_trim() In ext4_mb_add_n_trim(), lg_prealloc_lock should be taken when changing the lg_prealloc_list. Signed-off-by: Niu Yawei Change-Id: Icc62d87a682b0ebf70ad12e148a52b864bf1fdb8 Reviewed-on: http://review.whamcloud.com/4961 Reviewed-by: Bobi Jam Tested-by: Hudson Reviewed-by: Alex Zhuravlev Tested-by: Maloo Reviewed-by: Oleg Drokin --- .../patches/ext4-fix-ext4_mb_add_n_trim.patch | 22 ++++++++++++++++++++++ .../kernel_patches/series/ldiskfs-2.6-rhel6.series | 1 + .../series/ldiskfs-2.6-sles11.series | 1 + 3 files changed, 24 insertions(+) create mode 100644 ldiskfs/kernel_patches/patches/ext4-fix-ext4_mb_add_n_trim.patch 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 index 0000000..a394e18 --- /dev/null +++ b/ldiskfs/kernel_patches/patches/ext4-fix-ext4_mb_add_n_trim.patch @@ -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) { diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series index 261528a..8f2d401 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-rhel6.series @@ -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 diff --git a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series index 61a1d5d..4b0e293 100644 --- a/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series +++ b/ldiskfs/kernel_patches/series/ldiskfs-2.6-sles11.series @@ -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 -- 1.8.3.1