From 5f329fbe24daf42f3f00a358125c1bdfd0cb2014 Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 2 Oct 2019 10:12:38 -0700 Subject: [PATCH] - libparted/s390: Re-enabled virtio-attached DASD heuristics Fixes DASD backed virtblk devices --- ...e-enabled-virtio-attached-DASD-heuri.patch | 56 +++++++++++++++++++ parted.spec | 9 ++- 2 files changed, 63 insertions(+), 2 deletions(-) create mode 100644 0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch diff --git a/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch b/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch new file mode 100644 index 0000000..3086b0e --- /dev/null +++ b/0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch @@ -0,0 +1,56 @@ +From a943ad27eb3fa36b2d3161fd8cca9bfaa3a84911 Mon Sep 17 00:00:00 2001 +From: Viktor Mihajlovski +Date: Fri, 27 Sep 2019 18:34:46 +0300 +Subject: [PATCH] libparted/s390: Re-enabled virtio-attached DASD heuristics + +DASDs attached to KVM guest as virtio-blk devices are only handled +properly, if the unique DASD geometry is detected. Commit id +61dd3d4c5eb782eb43caa95342e63727db3f8281 has prevented proper geometry +detection. Fixed by making sure that HDIO_GETGEO takes precedence +on s390[x]. + +Signed-off-by: Viktor Mihajlovski +Signed-off-by: Brian C. Lane +(cherry picked from commit 52360db2f5397b7842d2ed90bf946c5e8fa91750) +--- + libparted/arch/linux.c | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index bb4d5ea..09ec781 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -867,6 +867,7 @@ _device_probe_geometry (PedDevice* dev) + LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); + struct stat dev_stat; + struct hd_geometry geometry; ++ int geometry_is_valid = 0; + int sector_size = 0; + + if (!_device_stat (dev, &dev_stat)) +@@ -884,13 +885,19 @@ _device_probe_geometry (PedDevice* dev) + dev->bios_geom.heads = 0; + dev->bios_geom.cylinders = 0; + ++ geometry_is_valid = !ioctl (arch_specific->fd, HDIO_GETGEO, &geometry) ++ && geometry.sectors && geometry.heads; ++ ++#if defined __s390__ || defined __s390x__ ++ if (geometry_is_valid) { ++#else + if (!ioctl (arch_specific->fd, BLKSSZGET, §or_size)) { + /* get the sector count first */ + dev->bios_geom.sectors = 1 + (sector_size / PED_SECTOR_SIZE_DEFAULT); + dev->bios_geom.heads = 255; +- } else if (!ioctl (arch_specific->fd, HDIO_GETGEO, &geometry) +- && geometry.sectors && geometry.heads) { +- /* if BLKSSZGET failed, try the deprecated HDIO_GETGEO */ ++ } else if (geometry_is_valid) { ++ /* if BLKSSZGET failed, use deprecated HDIO_GETGEO result */ ++#endif + dev->bios_geom.sectors = geometry.sectors; + dev->bios_geom.heads = geometry.heads; + } else { +-- +2.21.0 + diff --git a/parted.spec b/parted.spec index e4a6237..8ff91ca 100644 --- a/parted.spec +++ b/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.2.153 -Release: 1%{?dist} +Release: 2%{?dist} License: GPLv3+ URL: http://www.gnu.org/software/parted @@ -14,7 +14,8 @@ Source2: pubkey.phillip.susi Source3: pubkey.brian.lane # Upstream still uses python2 for these scripts -Patch0000: 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch +Patch0092: 0092-Switch-gpt-header-move-and-msdos-overlap-to-python3.patch +Patch0100: 0100-libparted-s390-Re-enabled-virtio-attached-DASD-heuri.patch BuildRequires: gcc BuildRequires: e2fsprogs-devel @@ -126,6 +127,10 @@ make check %changelog +* Wed Oct 02 2019 Brian C. Lane - 3.2.153-2 +- libparted/s390: Re-enabled virtio-attached DASD heuristics + Fixes DASD backed virtblk devices + * Mon Aug 12 2019 Brian C. Lane - 3.2.153-1 - New upstream ALPHA release v3.2.153 - Includes all patches except the python2 -> python3 change for test helpers