Michael Tokarev: several fixes for mdmon argument processing (#691671)

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


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

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

several fixes for mdmon argument processing (#691671)

---

 debian/changelog                                   |    4 ++
 ...-takeover-when-original-was-started-with-.patch |   37 ++++++++++++++++++++
 debian/patches/mdmon-fix-arg-parsing.patch         |   32 +++++++++++++++++
 .../patches/mdmon-fix-arg-processing-for-a.patch   |   31 ++++++++++++++++
 debian/patches/series                              |    3 ++
 5 files changed, 107 insertions(+), 0 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 2a98218..fe0eb2d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,10 @@ mdadm (3.2.5-4) UNRELEASED; urgency=low
   * super0: do not override uuid with homehost.  The bug prevented
     re-creating an array with v0.90 superblock with the specified uuid
     when homehost is also specified.  (Closes: #686703)
+  * several fixes for mdmon argument processing (Closes: #691671):
+    - allow --takeover when original was started with --offroot
+    - fix arg parsing.
+    - fix arg processing for -a
 
  -- Michael Tokarev <mjt at tls.msk.ru>  Sat, 20 Oct 2012 19:20:12 +0400
 
diff --git a/debian/patches/mdmon-allow-takeover-when-original-was-started-with-.patch b/debian/patches/mdmon-allow-takeover-when-original-was-started-with-.patch
new file mode 100644
index 0000000..ad643e4
--- /dev/null
+++ b/debian/patches/mdmon-allow-takeover-when-original-was-started-with-.patch
@@ -0,0 +1,37 @@
+From c4e96a305fbca4f83ae9f3a81482481524380905 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb at suse.de>
+Date: Mon, 20 Aug 2012 10:37:21 +1000
+Subject: mdmon: allow --takeover when original was started with --offroot
+Bug-Debian: http://bugs.debian.org/691671
+Comment: from stable/bugfix upstream 3.2.6 version
+Comment: one of the 3 patches fixing mentioned issues
+
+As --offroot causes ARGV[0] to be changed, we need to be more
+lenient when checking that the mdmon we are about to kill really
+is mdmon.  i.e. allow name to be "@dmon" instead.
+
+Signed-off-by: NeilBrown <neilb at suse.de>
+---
+ mdmon.c |    6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/mdmon.c b/mdmon.c
+index 2d0503d..54e1238 100644
+--- a/mdmon.c
++++ b/mdmon.c
+@@ -184,7 +184,11 @@ static void try_kill_monitor(pid_t pid, char *devname, int sock)
+ 	buf[sizeof(buf)-1] = 0;
+ 	close(fd);
+ 
+-	if (n < 0 || !strstr(buf, "mdmon"))
++	/* Note that if started with --offroot, the name
++	 * might be "@dmon"
++	 */
++	if (n < 0 || !(strstr(buf, "mdmon") ||
++		       strstr(buf, "@dmon")))
+ 		return;
+ 
+ 	kill(pid, SIGTERM);
+-- 
+1.7.10.4
+
diff --git a/debian/patches/mdmon-fix-arg-parsing.patch b/debian/patches/mdmon-fix-arg-parsing.patch
new file mode 100644
index 0000000..5c147cc
--- /dev/null
+++ b/debian/patches/mdmon-fix-arg-parsing.patch
@@ -0,0 +1,32 @@
+From 68ad53b301b6fc722fee6d32a5267c1a4506452d Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb at suse.de>
+Date: Mon, 9 Jul 2012 16:50:22 +1000
+Subject: mdmon: fix arg parsing.
+Bug-Debian: http://bugs.debian.org/691671
+Comment: from stable/bugfix upstream 3.2.6 version
+Comment: one of the 3 patches fixing mentioned issues
+
+-t aka --takeover should not be setting container_name.
+It sets it to NULL which causes failure when you try
+  mdmon --all --takeover
+
+Signed-off-by: NeilBrown <neilb at suse.de>
+---
+ mdmon.c |    1 -
+ 1 file changed, 1 deletion(-)
+
+diff --git a/mdmon.c b/mdmon.c
+index 2093476..dee02a9 100644
+--- a/mdmon.c
++++ b/mdmon.c
+@@ -306,7 +306,6 @@ int main(int argc, char *argv[])
+ 			all = 1;
+ 			break;
+ 		case 't':
+-			container_name = optarg;
+ 			takeover = 1;
+ 			break;
+ 		case OffRootOpt:
+-- 
+1.7.10.4
+
diff --git a/debian/patches/mdmon-fix-arg-processing-for-a.patch b/debian/patches/mdmon-fix-arg-processing-for-a.patch
new file mode 100644
index 0000000..c7f66a5
--- /dev/null
+++ b/debian/patches/mdmon-fix-arg-processing-for-a.patch
@@ -0,0 +1,31 @@
+From 23084aaa76d9fc3121ff2ab38c04ee9893793e00 Mon Sep 17 00:00:00 2001
+From: NeilBrown <neilb at suse.de>
+Date: Mon, 20 Aug 2012 10:33:50 +1000
+Subject: mdmon: fix arg processing for -a
+Bug-Debian: http://bugs.debian.org/691671
+Comment: from stable/bugfix upstream 3.2.6 version
+Comment: one of the 3 patches fixing mentioned issues
+
+'-a' was not being recognised as an abbreviation for '--all'.
+
+Signed-off-by: NeilBrown <neilb at suse.de>
+---
+ mdmon.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mdmon.c b/mdmon.c
+index dee02a9..2d0503d 100644
+--- a/mdmon.c
++++ b/mdmon.c
+@@ -299,7 +299,7 @@ int main(int argc, char *argv[])
+ 		{NULL, 0, NULL, 0}
+ 	};
+ 
+-	while ((opt = getopt_long(argc, argv, "th", options, NULL)) != -1) {
++	while ((opt = getopt_long(argc, argv, "tha", options, NULL)) != -1) {
+ 		switch (opt) {
+ 		case 'a':
+ 			container_name = argv[optind-1];
+-- 
+1.7.10.4
+
diff --git a/debian/patches/series b/debian/patches/series
index 3b3e86d..370ad9a 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,6 @@ spelling-and-manpages.patch
 fix-enough-function-for-RAID10.patch
 fix-segfaults-in-detail.patch
 super0-do-not-override-uuid-with-homehost.patch
+mdmon-allow-takeover-when-original-was-started-with-.patch
+mdmon-fix-arg-parsing.patch
+mdmon-fix-arg-processing-for-a.patch




More information about the pkg-mdadm-commits mailing list