diff mbox series

[2/4] kpartx: recognize DASD on loop devices again

Message ID 20190709073909.32112-3-martin.wilck@suse.com (mailing list archive)
State Not Applicable, archived
Delegated to: christophe varoqui
Headers show
Series multipath-patches for 0.8.2 | expand

Commit Message

Martin Wilck July 9, 2019, 7:40 a.m. UTC
From: Martin Wilck <mwilck@suse.com>

Since 4d57b868, DASD partition tables are only recognized on
DASD hardware. This turns out to break certain software that works
e.g. with DASD partition tables on loop devices. The problem that
4d57b868 attempted to fix was that "unlabeled disk" format has
no signature at all and is detected on any volume, including
empty ones.

With this patch, DASD partition table formats other than "unlabeled
disk" are detected on non-DASD devices again.

Fixes: 4d57b868 "kpartx: only recognize dasd part table on DASD"
Reviewed-by: Benjamin Marzinski <bmarzins@redhat.com>
Signed-off-by: Martin Wilck <mwilck@suse.com>
---
 kpartx/dasd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/kpartx/dasd.c b/kpartx/dasd.c
index d95d8ca0..4e7e4743 100644
--- a/kpartx/dasd.c
+++ b/kpartx/dasd.c
@@ -133,9 +133,6 @@  read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
 			/* Couldn't open the device */
 			return -1;
 		}
-	} else if ((unsigned int)major(sbuf.st_rdev) != 94) {
-			/* Not a DASD */
-			return -1;
 	} else {
 		fd_dasd = dup(fd);
 		if (fd_dasd < 0)
@@ -279,6 +276,10 @@  read_dasd_pt(int fd, struct slice all, struct slice *sp, int ns)
 			size = disksize;
 			if (fmt_size < size)
 				size = fmt_size;
+		} else if ((unsigned int)major(sbuf.st_rdev) != 94) {
+			/* Not a DASD */
+			retval = -1;
+			goto out;
 		} else
 			size = disksize;