]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2013 01:03:45 +0000 (17:03 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 1 Mar 2013 01:03:45 +0000 (17:03 -0800)
added patches:
ext4-fix-race-in-ext4_mb_add_n_trim.patch

queue-3.0/ext4-fix-race-in-ext4_mb_add_n_trim.patch [new file with mode: 0644]
queue-3.0/series

diff --git a/queue-3.0/ext4-fix-race-in-ext4_mb_add_n_trim.patch b/queue-3.0/ext4-fix-race-in-ext4_mb_add_n_trim.patch
new file mode 100644 (file)
index 0000000..3a39d75
--- /dev/null
@@ -0,0 +1,46 @@
+From f1167009711032b0d747ec89a632a626c901a1ad Mon Sep 17 00:00:00 2001
+From: Niu Yawei <yawei.niu@gmail.com>
+Date: Fri, 1 Feb 2013 21:31:27 -0500
+Subject: ext4: fix race in ext4_mb_add_n_trim()
+
+From: Niu Yawei <yawei.niu@gmail.com>
+
+commit f1167009711032b0d747ec89a632a626c901a1ad upstream.
+
+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>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/mballoc.c |    6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+--- a/fs/ext4/mballoc.c
++++ b/fs/ext4/mballoc.c
+@@ -4111,7 +4111,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);
+@@ -4135,12 +4135,12 @@ 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) {
+               ext4_mb_discard_lg_preallocations(sb, lg,
+-                                              order, lg_prealloc_count);
++                                                order, lg_prealloc_count);
+               return;
+       }
+       return ;
index 8a28cdf040438b55c08c3f8caf0b80ce76cd0568..da595e588be22b4f810c59c3c4ad6722bf96eb2d 100644 (file)
@@ -12,3 +12,4 @@ idr-fix-a-subtle-bug-in-idr_get_next.patch
 firewire-add-minor-number-range-check-to-fw_device_init.patch
 sysctl-fix-null-checking-in-bin_dn_node_address.patch
 media-rc-unlock-on-error-in-show_protocols.patch
+ext4-fix-race-in-ext4_mb_add_n_trim.patch