Michael Tokarev: Fix 'enough' function for RAID10 (#691668)

Michael Tokarev mjt at alioth.debian.org
Sun Oct 28 20:40:21 UTC 2012


Module: mdadm
Branch: master
Commit: 37be04cfef9838b79873b56845b4f753bfbf1b07
URL:    http://git.debian.org/?p=pkg-mdadm/mdadm.git;a=commit;h=37be04cfef9838b79873b56845b4f753bfbf1b07

Author: Michael Tokarev <mjt at tls.msk.ru>
Date:   Sun Oct 28 20:52:16 2012 +0400

Fix 'enough' function for RAID10 (#691668)

---

 debian/changelog                                   |    3 +
 .../patches/fix-enough-function-for-RAID10.patch   |   46 ++++++++++++++++++++
 debian/patches/series                              |    1 +
 3 files changed, 50 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 35ae868..2427323 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ mdadm (3.2.5-4) UNRELEASED; urgency=low
     version which creates /run, and the initscript itself is started
     after local_fs is processed, so this is merely a no-op, but let's
     do it for consistency.
+  * Fix 'enough' function for RAID10, to prevent starting of a RAID10
+    array which does not have required minimum of component devices.
+    (Closes: #691668).
 
  -- Michael Tokarev <mjt at tls.msk.ru>  Sat, 20 Oct 2012 19:20:12 +0400
 
diff --git a/debian/patches/fix-enough-function-for-RAID10.patch b/debian/patches/fix-enough-function-for-RAID10.patch
new file mode 100644
index 0000000..6f2ae99
--- /dev/null
+++ b/debian/patches/fix-enough-function-for-RAID10.patch
@@ -0,0 +1,46 @@
+From 2117ad1dd1b79cf6d02a065d9e38076aa9f4788d Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb at suse.de>
+Date: Thu, 27 Sep 2012 16:58:44 +1000
+Subject: Fix 'enough' function for RAID10.
+Bug-Debian: http://bugs.debian.org/691668
+Comment: from stable/bugfix 3.2.6 upstream version
+
+The 'enough' function is written to work with 'near' arrays only
+in that is implicitly assumes that the offset from one 'group' of
+devices to the next is the same as the number of copies.
+In reality it is the number of 'near' copies.
+
+So change it to make this number explicit.
+
+Reported-by: Jakub Husák <jakub at gooseman.cz>
+Signed-off-by: NeilBrown <neilb at suse.de>
+---
+ util.c |    7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/util.c b/util.c
+index 83f3187..eef0d6f 100644
+--- a/util.c
++++ b/util.c
+@@ -332,14 +332,15 @@ int enough(int level, int raid_disks, int layout, int clean, char *avail)
+ 			/* there must be one of the 'copies' form 'first' */
+ 			int n = copies;
+ 			int cnt=0;
++			int this = first;
+ 			while (n--) {
+-				if (avail[first])
++				if (avail[this])
+ 					cnt++;
+-				first = (first+1) % raid_disks;
++				this = (this+1) % raid_disks;
+ 			}
+ 			if (cnt == 0)
+ 				return 0;
+-
++			first = (first+(layout&255)) % raid_disks;
+ 		} while (first != 0);
+ 		return 1;
+ 
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index d679ef1..231f0e9 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -3,3 +3,4 @@ debian-disable-udev-incr-assembly.diff
 debian-no-Werror.diff
 sha1-includes.diff
 spelling-and-manpages.patch
+fix-enough-function-for-RAID10.patch




More information about the pkg-mdadm-commits mailing list