parted/tests-add-dev-md-check-to-t6100.patch

119 lines
4.2 KiB
Diff
Raw Normal View History

From: Sebastian Parschauer <sparschauer@suse.de>
Date: Tue, 20 Feb 2018 12:16:26 +0100
Subject: tests: Add /dev/md/ check to t6100
For: libparted-canonicalize-dev-md-paths.patch
References: bsc#1078820
Patch-mainline: submitted, 2018-02-20
The test t6100 checks creating two partitions with /dev/md99 and
a gpt disk label. But using an md name with the symlink in /dev/md/
is not tested. That path might not be canonicalized and the BLKPG*
handling cannot find the existing partitions in /sys/block/$dev/.
That can be observed when creating the second partition while the
first one is in use.
So move common code to new functions create_mddev() and
remove_mdparts(), check if the swap tools are available, retest with
/dev/md/pedtest99, msdos disk label, and the first partition as swap.
Signed-off-by: Sebastian Parschauer <sparschauer@suse.de>
---
tests/t6100-mdraid-partitions.sh | 62 +++++++++++++++++++++++++++++++++++-----
1 file changed, 55 insertions(+), 7 deletions(-)
Accepting request 760713 from home:anicka:branches:Base:System - fix crash in do_resizepart + parted-fix-end_input-usage.patch: Fix end_input usage in do_resizepart - update to version 3.3, noteworthy changes: - s390: Re-enabled virtio-attached DASD heuristics by using HDIO_GETGEO when probing device geometry. Fixes a bug with KVM virtio-blk backed by a DASD. Parted now recognizes NVMe devices, NVDIMM, and RAM drives. - Fix atari disklabel false positives by probing other labels first. - Fix resizepart to adjust the end to be -1 sector when using iec power of 2 units so that the next partition can start immediately following the new end, just like mkpart does. - Fix set and disk_set to not crash when there are no flags to set. - Fix a udev cookie leak when using resizepart on device-mapper devices. - Fix a gettext crash/error sometimes when using localized languages. - Fix fat resize to preverve boot code, and thus not render the filesystem unreconized by Windows. - Fix rescue command: the rescue command often failed to find filesystems due to leaving on cylinder alignment. - libparted-fs-resize: Prevent crash resizing FAT file systems with very deep directories with path names over 512 bytes long. - Use 512b sector size when communicating with device-mapper. Fixes problems with partitions being created too small on dm devices with sector sizes > 5121b - Don't crash in the disk_set command when a disk label is not found - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - If the user specifies start/end of the partition as cylinders and a cylinder has a size which is power of 2, then such address OBS-URL: https://build.opensuse.org/request/show/760713 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=144
2020-01-12 14:40:37 +01:00
Index: parted-3.3/tests/t6100-mdraid-partitions.sh
===================================================================
--- parted-3.3.orig/tests/t6100-mdraid-partitions.sh
+++ parted-3.3/tests/t6100-mdraid-partitions.sh
@@ -21,6 +21,7 @@
require_root_
require_scsi_debug_module_
require_mdadm_
+require_swap_
# create memory-backed device
scsi_debug_setup_ dev_size_mb=10 > dev-name ||
Accepting request 760713 from home:anicka:branches:Base:System - fix crash in do_resizepart + parted-fix-end_input-usage.patch: Fix end_input usage in do_resizepart - update to version 3.3, noteworthy changes: - s390: Re-enabled virtio-attached DASD heuristics by using HDIO_GETGEO when probing device geometry. Fixes a bug with KVM virtio-blk backed by a DASD. Parted now recognizes NVMe devices, NVDIMM, and RAM drives. - Fix atari disklabel false positives by probing other labels first. - Fix resizepart to adjust the end to be -1 sector when using iec power of 2 units so that the next partition can start immediately following the new end, just like mkpart does. - Fix set and disk_set to not crash when there are no flags to set. - Fix a udev cookie leak when using resizepart on device-mapper devices. - Fix a gettext crash/error sometimes when using localized languages. - Fix fat resize to preverve boot code, and thus not render the filesystem unreconized by Windows. - Fix rescue command: the rescue command often failed to find filesystems due to leaving on cylinder alignment. - libparted-fs-resize: Prevent crash resizing FAT file systems with very deep directories with path names over 512 bytes long. - Use 512b sector size when communicating with device-mapper. Fixes problems with partitions being created too small on dm devices with sector sizes > 5121b - Don't crash in the disk_set command when a disk label is not found - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - If the user specifies start/end of the partition as cylinders and a cylinder has a size which is power of 2, then such address OBS-URL: https://build.opensuse.org/request/show/760713 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=144
2020-01-12 14:40:37 +01:00
@@ -40,14 +41,28 @@ parted -s "$scsi_dev" mklabel gpt \
compare /dev/null out || fail=1
wait_for_dev_to_appear_ ${scsi_dev}2 || { fail=1; cat /proc/partitions; }
+create_mddev() {
+ # create mdraid on top of both partitions
Accepting request 760713 from home:anicka:branches:Base:System - fix crash in do_resizepart + parted-fix-end_input-usage.patch: Fix end_input usage in do_resizepart - update to version 3.3, noteworthy changes: - s390: Re-enabled virtio-attached DASD heuristics by using HDIO_GETGEO when probing device geometry. Fixes a bug with KVM virtio-blk backed by a DASD. Parted now recognizes NVMe devices, NVDIMM, and RAM drives. - Fix atari disklabel false positives by probing other labels first. - Fix resizepart to adjust the end to be -1 sector when using iec power of 2 units so that the next partition can start immediately following the new end, just like mkpart does. - Fix set and disk_set to not crash when there are no flags to set. - Fix a udev cookie leak when using resizepart on device-mapper devices. - Fix a gettext crash/error sometimes when using localized languages. - Fix fat resize to preverve boot code, and thus not render the filesystem unreconized by Windows. - Fix rescue command: the rescue command often failed to find filesystems due to leaving on cylinder alignment. - libparted-fs-resize: Prevent crash resizing FAT file systems with very deep directories with path names over 512 bytes long. - Use 512b sector size when communicating with device-mapper. Fixes problems with partitions being created too small on dm devices with sector sizes > 5121b - Don't crash in the disk_set command when a disk label is not found - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - If the user specifies start/end of the partition as cylinders and a cylinder has a size which is power of 2, then such address OBS-URL: https://build.opensuse.org/request/show/760713 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=144
2020-01-12 14:40:37 +01:00
+ mdadm -C $md_dev -e0 --force -R -l1 -n2 "${scsi_dev}1" "${scsi_dev}2"
+ wait_for_dev_to_appear_ ${md_dev} || { fail=1; cat /proc/partitions; }
+}
+
cleanup_fn_() {
# stop mdraid array
mdadm -S $md_dev || warn_ "Failed to stop MD array, $md_dev"
}
Accepting request 760713 from home:anicka:branches:Base:System - fix crash in do_resizepart + parted-fix-end_input-usage.patch: Fix end_input usage in do_resizepart - update to version 3.3, noteworthy changes: - s390: Re-enabled virtio-attached DASD heuristics by using HDIO_GETGEO when probing device geometry. Fixes a bug with KVM virtio-blk backed by a DASD. Parted now recognizes NVMe devices, NVDIMM, and RAM drives. - Fix atari disklabel false positives by probing other labels first. - Fix resizepart to adjust the end to be -1 sector when using iec power of 2 units so that the next partition can start immediately following the new end, just like mkpart does. - Fix set and disk_set to not crash when there are no flags to set. - Fix a udev cookie leak when using resizepart on device-mapper devices. - Fix a gettext crash/error sometimes when using localized languages. - Fix fat resize to preverve boot code, and thus not render the filesystem unreconized by Windows. - Fix rescue command: the rescue command often failed to find filesystems due to leaving on cylinder alignment. - libparted-fs-resize: Prevent crash resizing FAT file systems with very deep directories with path names over 512 bytes long. - Use 512b sector size when communicating with device-mapper. Fixes problems with partitions being created too small on dm devices with sector sizes > 5121b - Don't crash in the disk_set command when a disk label is not found - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - If the user specifies start/end of the partition as cylinders and a cylinder has a size which is power of 2, then such address OBS-URL: https://build.opensuse.org/request/show/760713 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=144
2020-01-12 14:40:37 +01:00
-# create mdraid on top of both partitions with v0.90 metadata
-mdadm -C $md_dev -e0 --force -R -l1 -n2 "${scsi_dev}1" "${scsi_dev}2"
-wait_for_dev_to_appear_ ${md_dev} || { fail=1; cat /proc/partitions; }
+remove_mdparts() {
+ # Remove partitions from the raid device.
+ parted -s $md_dev rm 2 rm 1 > out 2>&1 || fail=1
+ compare /dev/null out || fail=1
+
+ # Verify that kernel has been informed about those removals.
+ wait_for_dev_to_disappear_ ${md_dev}p1 2 || { fail=1; cat /proc/partitions; }
+ wait_for_dev_to_disappear_ ${md_dev}p2 2 || { fail=1; cat /proc/partitions; }
+}
+
+create_mddev
# create gpt and two partitions on the raid device
parted -s $md_dev mklabel gpt \
Accepting request 760713 from home:anicka:branches:Base:System - fix crash in do_resizepart + parted-fix-end_input-usage.patch: Fix end_input usage in do_resizepart - update to version 3.3, noteworthy changes: - s390: Re-enabled virtio-attached DASD heuristics by using HDIO_GETGEO when probing device geometry. Fixes a bug with KVM virtio-blk backed by a DASD. Parted now recognizes NVMe devices, NVDIMM, and RAM drives. - Fix atari disklabel false positives by probing other labels first. - Fix resizepart to adjust the end to be -1 sector when using iec power of 2 units so that the next partition can start immediately following the new end, just like mkpart does. - Fix set and disk_set to not crash when there are no flags to set. - Fix a udev cookie leak when using resizepart on device-mapper devices. - Fix a gettext crash/error sometimes when using localized languages. - Fix fat resize to preverve boot code, and thus not render the filesystem unreconized by Windows. - Fix rescue command: the rescue command often failed to find filesystems due to leaving on cylinder alignment. - libparted-fs-resize: Prevent crash resizing FAT file systems with very deep directories with path names over 512 bytes long. - Use 512b sector size when communicating with device-mapper. Fixes problems with partitions being created too small on dm devices with sector sizes > 5121b - Don't crash in the disk_set command when a disk label is not found - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - libparted-fs-resize: Prevent crash resizing FAT16 file systems. - If the user specifies start/end of the partition as cylinders and a cylinder has a size which is power of 2, then such address OBS-URL: https://build.opensuse.org/request/show/760713 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=144
2020-01-12 14:40:37 +01:00
@@ -58,12 +73,45 @@ compare /dev/null out || fail=1
# Verify that kernel has been informed about the second device.
wait_for_dev_to_appear_ ${md_dev}p2 || { fail=1; cat /proc/partitions; }
-# Remove partitions from the raid device.
-parted -s $md_dev rm 2 rm 1 > out 2>&1 || fail=1
+remove_mdparts
+
+########################################################################
+# Second part with /dev/md/ symlink, msdos label and busy swap partition
+
+cleanup_fn_
+
+# Arbitrary name, not likely to be used already
+md_name=pedtest99
+md_dev=/dev/md/$md_name
+
+test -b $md_dev && skip_ "$md_dev already exists"
+
+create_mddev
+
+# create msdos and one partition on the raid device
+parted -s $md_dev mklabel msdos \
+ mkpart primary ext2 1M 2M > out 2>&1 || fail=1
+compare /dev/null out || fail=1
+
+# Verify that kernel has been informed about the device.
+wait_for_dev_to_appear_ ${md_dev}p1 || { fail=1; cat /proc/partitions; }
+
+# Create swap filesystem
+mkswap -f ${md_dev}p1 || fail=1
+
+# Use as swap to make it busy
+swapon ${md_dev}p1 || fail=1
+
+# create msdos and one partition on the raid device
+parted -s $md_dev mkpart primary ext2 2M 3M > out 2>&1 || fail=1
compare /dev/null out || fail=1
-# Verify that kernel has been informed about those removals.
-wait_for_dev_to_disappear_ ${md_dev}p1 2 || { fail=1; cat /proc/partitions; }
-wait_for_dev_to_disappear_ ${md_dev}p2 2 || { fail=1; cat /proc/partitions; }
+# Verify that kernel has been informed about the second device.
+wait_for_dev_to_appear_ ${md_dev}p2 || { fail=1; cat /proc/partitions; }
+
+# Disable swap again
+swapoff ${md_dev}p1 || warn_ "Failed to disable swap on ${md_dev}p1"
+
+remove_mdparts
Exit $fail