kpartx: recognize DASD on loop devices again
PATCH 1/1 kpartx: recognize DASD on loop devices again
From: Martin Wilck <[email protected]>
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.
--- kpartx/dasd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
kpartx/dasd.c +4 -3
@@ -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); }
@@ -277,6 +274,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;
Signature · 1 line
2.21.0
Quoted 9 lines · Martin Wilck
From: Martin Wilck <[email protected]>
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 that4d57b868attempted to fix was that "unlabeled disk" format has no signature at all and is detected on any volume, including empty ones.
Quoted 4 lines
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"
Quoted 32 lines
--- kpartx/dasd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)kpartx/dasd.c +4
-3@@ -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); }@@ -277,6 +274,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;Signature · 1 line
2.21.0
Thanks for the review.
Martin, can you post a rebased version of this patch ?
Thanks,
Christophe
Quoted 52 lines · Benjamin Marzinski
Quoted 9 lines · Martin Wilck
From: Martin Wilck <[email protected]>
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 that4d57b868attempted to fix was that "unlabeled disk" format has no signature at all and is detected on any volume, including empty ones.Quoted 4 lines
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 <[email protected]>kpartx/dasd.c read_dasd_pt(int fd, struct slice all, struct slice
Quoted 9 lines
--- kpartx/dasd.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)kpartx/dasd.c +0
-0@@ -133,9 +133,6 @@ read_dasd_pt(int fd, struct slice all, struct slice*sp, int ns)
kpartx/dasd.c read_dasd_pt(int fd, struct slice all, struct slice
Quoted 10 lines
kpartx/dasd.c +0
-3/* 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); }@@ -277,6 +274,10 @@ read_dasd_pt(int fd, struct slice all, struct slice*sp, int ns)
Quoted 13 lines
kpartx/dasd.c +4
-1size = 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; --2.21.0