Accepting request 956862 from Base:System
OBS-URL: https://build.opensuse.org/request/show/956862 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/s390-tools?expand=0&rev=43
This commit is contained in:
commit
6d956224a4
@ -0,0 +1,169 @@
|
|||||||
|
Subject: [PATCH] [BZ 196440] zdev: Fix path resolution for multi-mount point file systems
|
||||||
|
From: Peter Oberparleiter <oberpar@linux.ibm.com>
|
||||||
|
|
||||||
|
Description: zdev: Fix path resolution for multi-mount point file systems
|
||||||
|
Symptom: Path resolution fails when a device provides multiple mount
|
||||||
|
points such as, for example, when using btrfs subvolumes, or
|
||||||
|
when mounting the same file system at multiple mount points.
|
||||||
|
Problem: The failure is caused by zdev relying on the MOUNTPOINT
|
||||||
|
attribute of lsblk's output which only contains a single
|
||||||
|
mount point.
|
||||||
|
Solution: Fix this by making use of lsblk's MOUNTPOINTS attribute that
|
||||||
|
contains the full list of mount points.
|
||||||
|
Reproduction: chzdev -f -e <dev_id_a> <dev_id_b> <dev_id_c>: In this case, if
|
||||||
|
the rootfs is soread across multiple devices, zdev adds only the
|
||||||
|
first device in to the initrd and the system does not boot.
|
||||||
|
Upstream-ID: 1faa5d2957eb82ab235778959d70a38062b7aa7d
|
||||||
|
Problem-ID: 196440
|
||||||
|
|
||||||
|
Upstream-Description:
|
||||||
|
|
||||||
|
zdev: Fix path resolution for multi-mount point file systems
|
||||||
|
|
||||||
|
zdev provides path resolution logic to determine which z-specific
|
||||||
|
devices contribute to the file system mounted at a specific mount point.
|
||||||
|
This logic is used by command-line option --by-path, but also to
|
||||||
|
determine the list of devices needed to enable the root file system.
|
||||||
|
|
||||||
|
Path resolution fails when a device provides multiple mount points such
|
||||||
|
as, for example, when using btrfs subvolumes, or when mounting the same
|
||||||
|
file system at multiple mount points. The failure is caused by zdev
|
||||||
|
relying on the MOUNTPOINT attribute of lsblk's output which only
|
||||||
|
contains a single mount point.
|
||||||
|
|
||||||
|
Fix this by making use of lsblk's MOUNTPOINTS attribute that contains
|
||||||
|
the full list of mount points. Note that MOUNTPOINTS was only introduced
|
||||||
|
with util-linux v2.37, therefore a fall-back to the old format is
|
||||||
|
needed.
|
||||||
|
|
||||||
|
Fixes: https://github.com/ibm-s390-linux/s390-tools/issues/129
|
||||||
|
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
|
||||||
|
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
|
||||||
|
Reviewed-by: Vineeth Vijayan <vneethv@linux.ibm.com>
|
||||||
|
Reviewed-by: Eduard Shishkin <edward6@linux.ibm.com>
|
||||||
|
Reported-by: Dan Horak <dan@danny.cz>
|
||||||
|
Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>
|
||||||
|
|
||||||
|
|
||||||
|
Signed-off-by: Peter Oberparleiter <oberpar@linux.ibm.com>
|
||||||
|
Index: s390-tools-service/zdev/src/blkinfo.c
|
||||||
|
===================================================================
|
||||||
|
--- s390-tools-service.orig/zdev/src/blkinfo.c
|
||||||
|
+++ s390-tools-service/zdev/src/blkinfo.c
|
||||||
|
@@ -7,6 +7,7 @@
|
||||||
|
* it under the terms of the MIT license. See LICENSE for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
+#include <ctype.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
@@ -16,6 +17,7 @@
|
||||||
|
#include "misc.h"
|
||||||
|
|
||||||
|
#define LSBLK_CMDLINE "lsblk -P -o NAME,MAJ:MIN,FSTYPE,UUID,MOUNTPOINT,PKNAME 2>/dev/null"
|
||||||
|
+#define LSBLK_CMDLINE2 "lsblk -P -o NAME,MAJ:MIN,FSTYPE,UUID,MOUNTPOINTS,PKNAME 2>/dev/null"
|
||||||
|
|
||||||
|
struct blkinfo {
|
||||||
|
struct devnode *devnode;
|
||||||
|
@@ -82,6 +84,26 @@ void blkinfo_print(struct blkinfo *blkin
|
||||||
|
printf("%*sparent=%s\n", level, "", blkinfo->parent);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Convert each occurrence of '\xnn' in @str to character with hex code <nn>. */
|
||||||
|
+static void hex_unescape(char *str)
|
||||||
|
+{
|
||||||
|
+ unsigned int c;
|
||||||
|
+
|
||||||
|
+ while ((str = strstr(str, "\\x"))) {
|
||||||
|
+ if (isxdigit(str[2]) && isxdigit(str[3]) &&
|
||||||
|
+ sscanf(str + 2, "%2x", &c) == 1) {
|
||||||
|
+ str[0] = (char)c;
|
||||||
|
+
|
||||||
|
+ /* Move remainder of str including nul behind <c>. */
|
||||||
|
+ memmove(str + /* <c> */ 1,
|
||||||
|
+ str + /* '\xnn' */ 4,
|
||||||
|
+ strlen(str + 4) + /* <nul> */ 1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ str++;
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static char *isolate_keyword(char **line_ptr, const char *keyword)
|
||||||
|
{
|
||||||
|
char *start, *end;
|
||||||
|
@@ -102,9 +124,11 @@ static char *isolate_keyword(char **line
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
-static struct blkinfo *blkinfo_from_line(char *line)
|
||||||
|
+static void add_blkinfos_from_line(struct util_list *blkinfos,
|
||||||
|
+ char *line)
|
||||||
|
{
|
||||||
|
- char *name, *majmin, *fstype, *uuid, *mountpoint, *parent;
|
||||||
|
+ char *name, *majmin, *fstype, *uuid, *mountpoint, *mountpoints, *parent;
|
||||||
|
+ struct blkinfo *blkinfo;
|
||||||
|
|
||||||
|
name = isolate_keyword(&line, "NAME=\"");
|
||||||
|
majmin = isolate_keyword(&line, "MAJ:MIN=\"");
|
||||||
|
@@ -113,21 +137,45 @@ static struct blkinfo *blkinfo_from_line
|
||||||
|
fstype = isolate_keyword(&line, "FSTYPE=\"");
|
||||||
|
uuid = isolate_keyword(&line, "UUID=\"");
|
||||||
|
mountpoint = isolate_keyword(&line, "MOUNTPOINT=\"");
|
||||||
|
+ mountpoints = isolate_keyword(&line, "MOUNTPOINTS=\"");
|
||||||
|
parent = isolate_keyword(&line, "PKNAME=\"");
|
||||||
|
|
||||||
|
- return blkinfo_new(name, majmin, fstype, uuid, mountpoint, parent);
|
||||||
|
+ if (!mountpoints) {
|
||||||
|
+ /* Handle old lsblk output format. */
|
||||||
|
+ blkinfo = blkinfo_new(name, majmin, fstype, uuid, mountpoint,
|
||||||
|
+ parent);
|
||||||
|
+ ptrlist_add(blkinfos, blkinfo);
|
||||||
|
+ return;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* Restore newline mount point separator encoded as hex. */
|
||||||
|
+ hex_unescape(mountpoints);
|
||||||
|
+
|
||||||
|
+ /* Represent each mount point as a separate blkinfo to support
|
||||||
|
+ * resolution of multi-mount point file systems like btrfs
|
||||||
|
+ * subvolumes. */
|
||||||
|
+ while ((mountpoint = strsep(&mountpoints, "\n"))) {
|
||||||
|
+ blkinfo = blkinfo_new(name, majmin, fstype, uuid, mountpoint,
|
||||||
|
+ parent);
|
||||||
|
+ ptrlist_add(blkinfos, blkinfo);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
static struct util_list *blkinfos_read(void)
|
||||||
|
{
|
||||||
|
char *output, *curr, *next;
|
||||||
|
struct util_list *blkinfos;
|
||||||
|
- struct blkinfo *blkinfo;
|
||||||
|
|
||||||
|
if (cached_blkinfos)
|
||||||
|
return cached_blkinfos;
|
||||||
|
|
||||||
|
- output = misc_read_cmd_output(LSBLK_CMDLINE, 0, 1);
|
||||||
|
+ output = misc_read_cmd_output(LSBLK_CMDLINE2, 0, 1);
|
||||||
|
+ if (output && !*output) {
|
||||||
|
+ /* No output might indicate no support for new lsblk command-
|
||||||
|
+ * line format - fall back to old format. */
|
||||||
|
+ free(output);
|
||||||
|
+ output = misc_read_cmd_output(LSBLK_CMDLINE, 0, 1);
|
||||||
|
+ }
|
||||||
|
if (!output)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
@@ -136,9 +184,7 @@ static struct util_list *blkinfos_read(v
|
||||||
|
/* Iterate over each line. */
|
||||||
|
next = output;
|
||||||
|
while ((curr = strsep(&next, "\n"))) {
|
||||||
|
- blkinfo = blkinfo_from_line(curr);
|
||||||
|
- if (blkinfo)
|
||||||
|
- ptrlist_add(blkinfos, blkinfo);
|
||||||
|
+ add_blkinfos_from_line(blkinfos, curr);
|
||||||
|
}
|
||||||
|
|
||||||
|
free(output);
|
@ -0,0 +1,44 @@
|
|||||||
|
Subject: [PATCH] [BZ 196072] zdev: modify the lsblk output parser in lszdev
|
||||||
|
From: Vineeth Vijayan <vneethv@linux.ibm.com>
|
||||||
|
|
||||||
|
Description: zdev: modify the lsblk output parser in lszdev
|
||||||
|
Symptom: lsblk parser function in lszdev not working
|
||||||
|
Problem: Version 2.37+ of util-linux modified the output
|
||||||
|
characters of lsblk,which breaks the parser function.
|
||||||
|
Solution: Align the parser function to support latest changes
|
||||||
|
Reproduction: execute lszdev --by-path / command
|
||||||
|
Upstream-ID: ad024c06e16ec4bba31d19fb848b42c67113143d
|
||||||
|
Problem-ID: 196072
|
||||||
|
|
||||||
|
Upstream-Description:
|
||||||
|
|
||||||
|
zdev: modify the lsblk output parser in lszdev
|
||||||
|
|
||||||
|
Since version 2.37.x, with the commit 58b510e58 ("libsmartcols: sanitize
|
||||||
|
variable names on export output"), util-linux changes the output
|
||||||
|
characters of lsblk, where the ":" is replaced with an "_". Align the
|
||||||
|
lsblk output parser function in lszdev as per this change.
|
||||||
|
|
||||||
|
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
|
||||||
|
Suggested-by: Peter Oberparleiter <oberpar@linux.ibm.com>
|
||||||
|
Reported-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||||
|
Reviewed-by: Peter Oberparleiter <oberpar@linux.ibm.com>
|
||||||
|
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||||
|
Tested-by: Boris Fiuczynski <fiuczy@linux.ibm.com>
|
||||||
|
Signed-off-by: Jan Hoeppner <hoeppner@linux.ibm.com>
|
||||||
|
|
||||||
|
|
||||||
|
Signed-off-by: Vineeth Vijayan <vneethv@linux.ibm.com>
|
||||||
|
Index: s390-tools-service/zdev/src/blkinfo.c
|
||||||
|
===================================================================
|
||||||
|
--- s390-tools-service.orig/zdev/src/blkinfo.c
|
||||||
|
+++ s390-tools-service/zdev/src/blkinfo.c
|
||||||
|
@@ -108,6 +108,8 @@ static struct blkinfo *blkinfo_from_line
|
||||||
|
|
||||||
|
name = isolate_keyword(&line, "NAME=\"");
|
||||||
|
majmin = isolate_keyword(&line, "MAJ:MIN=\"");
|
||||||
|
+ if (!majmin)
|
||||||
|
+ majmin = isolate_keyword(&line, "MAJ_MIN=\"");
|
||||||
|
fstype = isolate_keyword(&line, "FSTYPE=\"");
|
||||||
|
uuid = isolate_keyword(&line, "UUID=\"");
|
||||||
|
mountpoint = isolate_keyword(&line, "MOUNTPOINT=\"");
|
@ -1,3 +1,15 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Feb 22 19:37:07 UTC 2022 - Mark Post <mpost@suse.com>
|
||||||
|
|
||||||
|
- Added s390-tools-sles15sp4-zdev-modify-the-lsblk-output-parser-in-lszdev.patch
|
||||||
|
for bsc#1196255. Version 2.37+ of util-linux modified the output
|
||||||
|
characters of lsblk,which breaks the parser function.
|
||||||
|
- Added s390-tools-sles15sp4-zdev-Fix-path-resolution-for-multi-mount-point-file-.patch
|
||||||
|
for bsc#1196254. Path resolution fails when a device provides
|
||||||
|
multiple mount points such as, for example, when using btrfs
|
||||||
|
subvolumes, or when mounting the same file system at multiple
|
||||||
|
mount points.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jan 12 21:27:13 UTC 2022 - Mark Post <mpost@suse.com>
|
Wed Jan 12 21:27:13 UTC 2022 - Mark Post <mpost@suse.com>
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# spec file for package s390-tools
|
# spec file for package s390-tools
|
||||||
#
|
#
|
||||||
# Copyright (c) 2001-2021 SUSE LLC
|
# Copyright (c) 2001-2022 SUSE LLC
|
||||||
#
|
#
|
||||||
# All modifications and additions to the file contributed by third parties
|
# All modifications and additions to the file contributed by third parties
|
||||||
# remain the property of their copyright owners, unless otherwise agreed
|
# remain the property of their copyright owners, unless otherwise agreed
|
||||||
@ -90,6 +90,8 @@ Source99: zfcp_host_configure.8
|
|||||||
# IBM patches
|
# IBM patches
|
||||||
Patch001: s390-tools-sles15sp4-chreipl-fcp-mpath-don-t-compress-the-manpage-before-.patch
|
Patch001: s390-tools-sles15sp4-chreipl-fcp-mpath-don-t-compress-the-manpage-before-.patch
|
||||||
Patch002: s390-tools-sles15sp4-chreipl-fcp-mpath-remove-shebang-from-chreipl-fcp-mp.patch
|
Patch002: s390-tools-sles15sp4-chreipl-fcp-mpath-remove-shebang-from-chreipl-fcp-mp.patch
|
||||||
|
Patch003: s390-tools-sles15sp4-zdev-modify-the-lsblk-output-parser-in-lszdev.patch
|
||||||
|
Patch004: s390-tools-sles15sp4-zdev-Fix-path-resolution-for-multi-mount-point-file-.patch
|
||||||
|
|
||||||
# SUSE patches
|
# SUSE patches
|
||||||
Patch900: s390-tools-sles12-zipl_boot_msg.patch
|
Patch900: s390-tools-sles12-zipl_boot_msg.patch
|
||||||
|
Loading…
Reference in New Issue
Block a user