rpms/kernel/F-11 linux-2.6-md-raid1-dont-assume-new-bvecs-are-init.patch, NONE, 1.1 kernel.spec, 1.1533, 1.1534

Chuck Ebbert cebbert at fedoraproject.org
Mon Apr 13 21:28:59 UTC 2009


Author: cebbert

Update of /cvs/pkgs/rpms/kernel/F-11
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv7021

Modified Files:
	kernel.spec 
Added Files:
	linux-2.6-md-raid1-dont-assume-new-bvecs-are-init.patch 
Log Message:
Fix oops in md raid1 resync (#495550)

linux-2.6-md-raid1-dont-assume-new-bvecs-are-init.patch:

--- NEW FILE linux-2.6-md-raid1-dont-assume-new-bvecs-are-init.patch ---
From: NeilBrown <neilb at suse.de>
Date: Mon, 6 Apr 2009 04:40:38 +0000 (+1000)
Subject: md/raid1 - don't assume newly allocated bvecs are initialised.
X-Git-Tag: v2.6.30-rc1~176^2
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=303a0e11d0ee136ad8f53f747f3c377daece763b

md/raid1 - don't assume newly allocated bvecs are initialised.

Since commit d3f761104b097738932afcc310fbbbbfb007ef92
newly allocated bvecs aren't initialised to NULL, so we have
to be more careful about freeing a bio which only managed
to get a few pages allocated to it.  Otherwise the resync
process crashes.

This patch is appropriate for 2.6.29-stable.

Cc: stable at kernel.org
Cc: "Jens Axboe" <jens.axboe at oracle.com>
Reported-by: Gabriele Tozzi <gabriele at tozzi.eu>
Signed-off-by: NeilBrown <neilb at suse.de>
---

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index b4f4bad..f2247b0 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -123,6 +123,7 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data)
 				goto out_free_pages;
 
 			bio->bi_io_vec[i].bv_page = page;
+			bio->bi_vcnt = i+1;
 		}
 	}
 	/* If not user-requests, copy the page pointers to all bios */
@@ -138,9 +139,9 @@ static void * r1buf_pool_alloc(gfp_t gfp_flags, void *data)
 	return r1_bio;
 
 out_free_pages:
-	for (i=0; i < RESYNC_PAGES ; i++)
-		for (j=0 ; j < pi->raid_disks; j++)
-			safe_put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page);
+	for (j=0 ; j < pi->raid_disks; j++)
+		for (i=0; i < r1_bio->bios[j]->bi_vcnt ; i++)
+			put_page(r1_bio->bios[j]->bi_io_vec[i].bv_page);
 	j = -1;
 out_free_bio:
 	while ( ++j < pi->raid_disks )


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/F-11/kernel.spec,v
retrieving revision 1.1533
retrieving revision 1.1534
diff -u -r1.1533 -r1.1534
--- kernel.spec	13 Apr 2009 18:35:55 -0000	1.1533
+++ kernel.spec	13 Apr 2009 21:28:27 -0000	1.1534
@@ -716,6 +716,9 @@
 
 Patch5000: linux-2.6-add-qcserial.patch
 
+# fix oops in md raid1 (#495550)
+Patch6000: linux-2.6-md-raid1-dont-assume-new-bvecs-are-init.patch
+
 Patch9001: revert-fix-modules_install-via-nfs.patch
 
 Patch9002: cpufreq-add-atom-to-p4-clockmod.patch
@@ -920,12 +923,14 @@
 %endif
 
 # more sanity checking; do it quietly
-for patch in %{patches} ; do
-  if [ ! -f $patch ] ; then
-    echo "ERROR: Patch  ${patch##/*/}  listed in specfile but is missing"
-    exit 1
-  fi
-done 2>/dev/null
+if [ "%{patches}" != "%%{patches}" ] ; then
+  for patch in %{patches} ; do
+    if [ ! -f $patch ] ; then
+      echo "ERROR: Patch  ${patch##/*/}  listed in specfile but is missing"
+      exit 1
+    fi
+  done 2>/dev/null
+fi
 
 patch_command='patch -p1 -F1 -s'
 ApplyPatch()
@@ -1331,6 +1336,8 @@
 ApplyPatch linux-2.6-v4l-dvb-fix-uint16_t-audio-h.patch
 ApplyPatch linux-2.6-revert-dvb-net-kabi-change.patch
 
+ApplyPatch linux-2.6-md-raid1-dont-assume-new-bvecs-are-init.patch
+
 # revert 8b249b6856f16f09b0e5b79ce5f4d435e439b9d6
 ApplyPatch revert-fix-modules_install-via-nfs.patch
 
@@ -1925,6 +1932,9 @@
 # and build.
 
 %changelog
+* Mon Apr 13 2009 Chuck Ebbert <cebbert at redhat.com>
+- Fix oops in md raid1 resync (#495550)
+
 * Mon Apr 13 2009 Eric Sandeen <sandeen at redhat.com>
 - Turn of CONFIG_SND_HDA_POWER_SAVE_DEFAULT again (#493972)
 




More information about the fedora-extras-commits mailing list