2b0cd7cceb
Rebased on top of Martin Wilck's queue of ACKed upstream commits * https://github.com/openSUSE/multipath-tools/tree/upstream-queue * All previous patches have been reordered, with the exception of 0011-libdmmp-Add-support-for-upcoming-json-c-0.14.0.patch which has been replaced with 0029-fix-boolean-value-with-json-c-0.14.patch Modify 0054-RH-add-mpathconf.patch * remove default enable_foreign and property blacklist_exceptions settings, and deal with the builtin default change from 0031-libmultipath-set-enable_foreign-to-NONE-by-default.patch. Fixes bz #1853668 Add 0048-Makefile.inc-trim-extra-information-from-systemd-ver.patch Add 0049-kpartx-fix-Wsign-compare-error.patch * The above two patches have been submitted upstream
54 lines
1.5 KiB
Diff
54 lines
1.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Benjamin Marzinski <bmarzins@redhat.com>
|
|
Date: Thu, 2 Jul 2020 19:38:26 -0500
|
|
Subject: [PATCH] kpartx: handle alternate bsd disklabel location
|
|
|
|
bsd disk labels can either be at the start of the second sector, or 64
|
|
bytes into the first sector, but kpartx only handled the first case.
|
|
However the second case is what parted creates, and what the linux
|
|
kernel partition code expects. kpartx should handle both cases.
|
|
|
|
Reviewed-by: Martin Wilck <mwilck@suse.com>
|
|
Signed-off-by: Benjamin Marzinski <bmarzins@redhat.com>
|
|
---
|
|
kpartx/bsd.c | 16 ++++++++++++++--
|
|
1 file changed, 14 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/kpartx/bsd.c b/kpartx/bsd.c
|
|
index 0e661fbc..950b0f92 100644
|
|
--- a/kpartx/bsd.c
|
|
+++ b/kpartx/bsd.c
|
|
@@ -1,6 +1,7 @@
|
|
#include "kpartx.h"
|
|
#include <stdio.h>
|
|
|
|
+#define BSD_LABEL_OFFSET 64
|
|
#define BSD_DISKMAGIC (0x82564557UL) /* The disk magic number */
|
|
#define XBSD_MAXPARTITIONS 16
|
|
#define BSD_FS_UNUSED 0
|
|
@@ -60,8 +61,19 @@ read_bsd_pt(int fd, struct slice all, struct slice *sp, unsigned int ns) {
|
|
return -1;
|
|
|
|
l = (struct bsd_disklabel *) bp;
|
|
- if (l->d_magic != BSD_DISKMAGIC)
|
|
- return -1;
|
|
+ if (l->d_magic != BSD_DISKMAGIC) {
|
|
+ /*
|
|
+ * BSD disklabels can also start 64 bytes offset from the
|
|
+ * start of the first sector
|
|
+ */
|
|
+ bp = getblock(fd, offset);
|
|
+ if (bp == NULL)
|
|
+ return -1;
|
|
+
|
|
+ l = (struct bsd_disklabel *)(bp + 64);
|
|
+ if (l->d_magic != BSD_DISKMAGIC)
|
|
+ return -1;
|
|
+ }
|
|
|
|
max_partitions = 16;
|
|
if (l->d_npartitions < max_partitions)
|
|
--
|
|
2.17.2
|
|
|