dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/Fix-oddity-where-mdadm-did-not-recognise-a-relative-.patch

2c1b57
From bb6f40bf9c458a13b1a780006733c034105e6d36 Mon Sep 17 00:00:00 2001
2c1b57
From: Wol <anthony@youngman.org.uk>
2c1b57
Date: Tue, 17 Jan 2017 17:47:05 +0000
2c1b57
Subject: [RHEL7.5 PATCH 003/169] Fix oddity where mdadm did not recognise
2c1b57
 a relative path
2c1b57
2c1b57
mdadm assumed that a pathname started with a "/", while an array
2c1b57
name didn't. This alters the logic so that if the first character
2c1b57
is not a "/" it tries to open an array, and if that fails it drops
2c1b57
through to the pathname code rather than terminating immediately
2c1b57
with an error.
2c1b57
2c1b57
Signed-off-by: Wol <anthony@youngman.org.uk>
2c1b57
Signed-off-by: Jes Sorensen <Jes.Sorensen@gmail.com>
2c1b57
---
2c1b57
 mdadm.c | 12 ++++++------
2c1b57
 1 file changed, 6 insertions(+), 6 deletions(-)
2c1b57
2c1b57
diff --git a/mdadm.c b/mdadm.c
2c1b57
index c3a265b..b5d89e4 100644
2c1b57
--- a/mdadm.c
2c1b57
+++ b/mdadm.c
2c1b57
@@ -1899,12 +1899,12 @@ static int misc_list(struct mddev_dev *devlist,
2c1b57
 			rv |= SetAction(dv->devname, c->action);
2c1b57
 			continue;
2c1b57
 		}
2c1b57
-		if (dv->devname[0] == '/')
2c1b57
-			mdfd = open_mddev(dv->devname, 1);
2c1b57
-		else {
2c1b57
-			mdfd = open_dev(dv->devname);
2c1b57
-			if (mdfd < 0)
2c1b57
-				pr_err("Cannot open %s\n", dv->devname);
2c1b57
+		switch(dv->devname[0] == '/') {
2c1b57
+			case 0:
2c1b57
+				mdfd = open_dev(dv->devname);
2c1b57
+				if (mdfd >= 0) break;
2c1b57
+			case 1:
2c1b57
+				mdfd = open_mddev(dv->devname, 1);  
2c1b57
 		}
2c1b57
 		if (mdfd>=0) {
2c1b57
 			switch(dv->disposition) {
2c1b57
-- 
2c1b57
2.7.4
2c1b57