diff --git a/SOURCES/0030-libparted-handle-logical-partitions-starting-immedia.patch b/SOURCES/0030-libparted-handle-logical-partitions-starting-immedia.patch new file mode 100644 index 0000000..ab6313e --- /dev/null +++ b/SOURCES/0030-libparted-handle-logical-partitions-starting-immedia.patch @@ -0,0 +1,117 @@ +From 535f60c9ef91cc662d5ccaecb2f7048a3c2241d9 Mon Sep 17 00:00:00 2001 +From: Phillip Susi +Date: Thu, 12 Jan 2012 14:53:56 -0500 +Subject: [PATCH] libparted: handle logical partitions starting immediately + after the EBR + +_blkpg_add_partition() set the length of the extended partition +to 2 sectors to allow LILO to be installed there, beacuse the +linux kernel does this. If a logical partition used that second +sector, adding it would fail beacuse of the overlap. Now +_blkpg_add_partition() will limit the length to only the first +sector if the second is used by a logical partition. + +Previously parted did create the partition table, and after a +reboot, the kernel would recognize the table, and happily create +the extended partition as 2 sectors long, thus overlapping the +logical partition, but when parted tried to recreate the same +table with BLKPG, the kernel rightly rejected it. + +(cherry picked from commit f503870153eda7659b09e52e4adeda3bebf06471) +--- + NEWS | 8 ++++++++ + libparted/arch/linux.c | 17 +++++++++++++++-- + tests/t2310-dos-extended-2-sector-min-offset.sh | 16 ++++------------ + 3 files changed, 27 insertions(+), 14 deletions(-) + +diff --git a/NEWS b/NEWS +index 4d30b1b..d1ab2a6 100644 +--- a/NEWS ++++ b/NEWS +@@ -11,6 +11,14 @@ GNU parted NEWS -*- outline -*- + + ** Bug Fixes + ++ libparted: handle logical partitions starting immediately after ++ the EBR. Creating a logical partition one sector after the EBR ++ used to cause parted to complain that it could not inform the ++ kernel of the changes, but after a reboot, everything was fine. ++ Parted will now correctly inform the kernel of the changes, but ++ only set the length of the extended partition to 1 sector instead ++ of two, which would cause it to overlap the logical partition. ++ + If a drive was 100 times an even multiple of two, sizes specified as + a percentage would trigger the exact placement rule and refuse to round + to the nearest half percent. +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 4daa881..788cdc3 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2371,8 +2371,21 @@ _blkpg_add_partition (PedDisk* disk, const PedPartition *part) + memset (&linux_part, 0, sizeof (linux_part)); + linux_part.start = part->geom.start * disk->dev->sector_size; + /* see fs/partitions/msdos.c:msdos_partition(): "leave room for LILO" */ +- if (part->type & PED_PARTITION_EXTENDED) +- linux_part.length = part->geom.length == 1 ? 512 : 1024; ++ if (part->type & PED_PARTITION_EXTENDED) { ++ linux_part.length = 1; ++ if (disk->dev->sector_size == 512) { ++ if (linux_part.length == 1) ++ linux_part.length = 2; ++ PedPartition *walk; ++ /* if the second sector is claimed by a logical partition, ++ then there's just no room for lilo, so don't try to use it */ ++ for (walk = part->part_list; walk; walk = walk->next) { ++ if (walk->geom.start == part->geom.start+1) ++ linux_part.length = 1; ++ } ++ } ++ linux_part.length *= disk->dev->sector_size; ++ } + else + linux_part.length = part->geom.length * disk->dev->sector_size; + linux_part.pno = part->num; +diff --git a/tests/t2310-dos-extended-2-sector-min-offset.sh b/tests/t2310-dos-extended-2-sector-min-offset.sh +index 89453ae..bd7defb 100644 +--- a/tests/t2310-dos-extended-2-sector-min-offset.sh ++++ b/tests/t2310-dos-extended-2-sector-min-offset.sh +@@ -1,8 +1,6 @@ + #!/bin/sh +-# Ensure that parted leaves at least 2 sectors between the beginning ++# Ensure that parted allows a single sector between the beginning + # of an extended partition and the first logical partition. +-# Before parted-2.3, it could be made to leave just one, and that +-# would cause trouble with the Linux kernel. + + # Copyright (C) 2010-2012 Free Software Foundation, Inc. + +@@ -35,7 +33,7 @@ cat < exp || framework_failure + BYT; + $scsi_dev:2048s:scsi:512:512:msdos:Linux scsi_debug:; + 1:64s:128s:65s:::lba; +-5:66s:128s:63s:::; ++5:65s:128s:64s:::; + EOF + + cat < err.exp || framework_failure +@@ -49,15 +47,9 @@ parted --align=min -s $scsi_dev mkpart extended 64s 128s> out 2>&1 || fail=1 + parted -m -s $scsi_dev u s print + compare /dev/null out || fail=1 + +-# Provoke a failure by trying to create a partition that starts just ++# Trying to create a partition that starts just + # one sector after the start of the extended partition. +-parted --align=min -s $scsi_dev mkpart logical 65s 128s > err 2>&1 && fail=1 +-compare err.exp err || fail=1 +- +-# The above failed, but created the partition nonetheless. Remove it. +-parted -s $scsi_dev rm 5 || fail=1 +- +-parted --align=min -s $scsi_dev mkpart logical 66s 128s > out 2>&1 || fail=1 ++parted --align=min -s $scsi_dev mkpart logical 65s 128s > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + parted -m -s $scsi_dev u s print > out 2>&1 +-- +2.1.0 + diff --git a/SOURCES/0031-tests-Add-a-test-for-device-mapper-partition-sizes-1.patch b/SOURCES/0031-tests-Add-a-test-for-device-mapper-partition-sizes-1.patch new file mode 100644 index 0000000..85f9e40 --- /dev/null +++ b/SOURCES/0031-tests-Add-a-test-for-device-mapper-partition-sizes-1.patch @@ -0,0 +1,106 @@ +From 1c5b0b263f08faa0649bf673a685d93ed9319bef Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 4 Feb 2015 16:31:00 -0800 +Subject: [PATCH 31/32] tests: Add a test for device-mapper partition sizes + (#1188431) + +device-mapper uses 512b sector units, not device specific sector sizes. +This test ensures that the correct partition size is created, no matter +what the device's sector size is. + +Related: rhbz#1188431 +--- + tests/Makefile.am | 1 + + tests/t6004-dm-512b-sectors.sh | 68 ++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 69 insertions(+) + create mode 100644 tests/t6004-dm-512b-sectors.sh + +diff --git a/tests/Makefile.am b/tests/Makefile.am +index faa0f37..1cf859c 100644 +--- a/tests/Makefile.am ++++ b/tests/Makefile.am +@@ -57,6 +57,7 @@ TESTS = \ + t6001-psep.sh \ + t6002-dm-many-partitions.sh \ + t6003-dm-uuid.sh \ ++ t6004-dm-512b-sectors.sh \ + t6100-mdraid-partitions.sh \ + t7000-scripting.sh \ + t8000-loop.sh \ +diff --git a/tests/t6004-dm-512b-sectors.sh b/tests/t6004-dm-512b-sectors.sh +new file mode 100644 +index 0000000..31abba9 +--- /dev/null ++++ b/tests/t6004-dm-512b-sectors.sh +@@ -0,0 +1,68 @@ ++#!/bin/sh ++# device-mapper sector sizes are 512b, make sure partitions are the correct ++# size when using larger sector sizes and a linear dm table. ++ ++# Copyright (C) 2015 Free Software Foundation, Inc. ++ ++# This program is free software; you can redistribute it and/or modify ++# it under the terms of the GNU General Public License as published by ++# the Free Software Foundation; either version 3 of the License, or ++# (at your option) any later version. ++ ++# This program is distributed in the hope that it will be useful, ++# but WITHOUT ANY WARRANTY; without even the implied warranty of ++# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++# GNU General Public License for more details. ++ ++# You should have received a copy of the GNU General Public License ++# along with this program. If not, see . ++ ++. "${srcdir=.}/init.sh"; path_prepend_ ../parted ++ ++require_root_ ++require_scsi_debug_module_ ++ ++grep '^#define USE_BLKID 1' "$CONFIG_HEADER" > /dev/null || ++ skip_ 'this system lacks a new-enough libblkid' ++ ++(dmsetup --help) > /dev/null 2>&1 || skip_test_ "No dmsetup installed" ++ ++# Device maps names - should be random to not conflict with existing ones on ++# the system ++linear_=plinear-$$test ++ ++cleanup_fn_() { ++ i=0 ++ udevadm settle ++ while [ $i -lt 10 ] ; do ++ [ -e "/dev/mapper/${linear_}1" ] && dmsetup remove ${linear_}1 ++ sleep .2 ++ [ -e "/dev/mapper/$linear_" ] && dmsetup remove $linear_ ++ sleep .2 ++ [ -e "/dev/mapper/${linear_}1" -o -e "/dev/mapper/$linear_" ] || i=10 ++ i=$((i + 1)) ++ done ++ udevadm settle ++} ++ ++# Create a 500M device ++ss=$sector_size_ ++scsi_debug_setup_ sector_size=$ss dev_size_mb=500 > dev-name || ++ skip_ 'failed to create scsi_debug device' ++scsi_dev=$(cat dev-name) ++ ++# Size of device, in 512b units ++scsi_dev_size=$(blockdev --getsz $scsi_dev) || framework_failure ++ ++dmsetup create $linear_ --table "0 $scsi_dev_size linear $scsi_dev 0" || framework_failure ++dev="/dev/mapper/$linear_" ++ ++# Create msdos partition table with a partition from 1MiB to 100MiB ++parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1 ++compare /dev/null out || fail=1 ++ ++# The size of the partition should be 100MiB, or 204800 512b sectors ++p1_size=$(blockdev --getsz ${dev}1) || framework_failure ++[ $p1_size == 204800 ] || fail=1 ++ ++Exit $fail +-- +2.1.0 + diff --git a/SOURCES/0032-libparted-device-mapper-uses-512b-sectors-1188431.patch b/SOURCES/0032-libparted-device-mapper-uses-512b-sectors-1188431.patch new file mode 100644 index 0000000..4253f6e --- /dev/null +++ b/SOURCES/0032-libparted-device-mapper-uses-512b-sectors-1188431.patch @@ -0,0 +1,43 @@ +From 07f2604aeeb20d187e7243007fc5ab1a0560a4b7 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Wed, 4 Feb 2015 16:46:07 -0800 +Subject: [PATCH 32/32] libparted: device mapper uses 512b sectors (#1188431) + +device mapper doesn't use the device's sector size when creating a +table. It always uses 512b units. This causes partitions to be created +8x smaller than expected on devices with 4906b sectors. + +Resolves: rhbz#1188431 +--- + libparted/arch/linux.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 788cdc3..1d11f58 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -2849,8 +2849,10 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + dm_task_destroy (task); + task = NULL; + ++ /* device-mapper uses 512b units, not the device's sector size */ + if ( ! (params = zasprintf ("%d:%d %lld", arch_specific->major, +- arch_specific->minor, part->geom.start))) ++ arch_specific->minor, ++ part->geom.start * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT)))) + goto err; + + task = dm_task_create (DM_DEVICE_CREATE); +@@ -2860,7 +2862,8 @@ _dm_add_partition (PedDisk* disk, PedPartition* part) + dm_task_set_name (task, vol_name); + if (vol_uuid) + dm_task_set_uuid (task, vol_uuid); +- dm_task_add_target (task, 0, part->geom.length, ++ /* device-mapper uses 512b units, not the device's sector size */ ++ dm_task_add_target (task, 0, part->geom.length * (disk->dev->sector_size / PED_SECTOR_SIZE_DEFAULT), + "linear", params); + if (!dm_task_set_cookie(task, &cookie, 0)) + goto err; +-- +2.1.0 + diff --git a/SOURCES/0033-libparted-Use-read-only-when-probing-devices-on-linu.patch b/SOURCES/0033-libparted-Use-read-only-when-probing-devices-on-linu.patch new file mode 100644 index 0000000..e4e71f2 --- /dev/null +++ b/SOURCES/0033-libparted-Use-read-only-when-probing-devices-on-linu.patch @@ -0,0 +1,218 @@ +From 468d537b07c3c1ad72e1ee1e9651a17c72038837 Mon Sep 17 00:00:00 2001 +From: Fedora Ninjas +Date: Thu, 6 Aug 2015 07:17:14 -0700 +Subject: [PATCH 33/35] libparted: Use read only when probing devices on linux + (#1245144) + +When a device is opened for RW closing it can trigger other actions, +like udev scanning it for partition changes. Use read only for the +init_* methods and RW for actual changes to the device. + +This adds _device_open which takes mode flags as an argument and turns +linux_open into a wrapper for it with RW_MODE. + +_device_open_ro is added to open the device with RD_MODE and increment +the open_counter. This is used in the init_* functions. + +_device_close is a wrapper around linux_close that decrements the +open_counter and is used in the init_* functions. + +All of these changes are self-contained with no external API changes. +The only visible change in behavior is that when a new PedDevice is +created the device is opened in RO_MODE instead of RW_MODE. + +Resolves: rhbz#1245144 +--- + libparted/arch/linux.c | 61 ++++++++++++++++++++++++++++++++++++-------------- + 1 file changed, 44 insertions(+), 17 deletions(-) + +diff --git a/libparted/arch/linux.c b/libparted/arch/linux.c +index 1d11f58..341bbbb 100644 +--- a/libparted/arch/linux.c ++++ b/libparted/arch/linux.c +@@ -287,6 +287,9 @@ struct blkdev_ioctl_param { + + static char* _device_get_part_path (PedDevice* dev, int num); + static int _partition_is_mounted_by_path (const char* path); ++static int _device_open (PedDevice* dev, int flags); ++static int _device_open_ro (PedDevice* dev); ++static int _device_close (PedDevice* dev); + + static int + _read_fd (int fd, char **buf) +@@ -830,7 +833,7 @@ init_ide (PedDevice* dev) + if (!_device_stat (dev, &dev_stat)) + goto error; + +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + if (ioctl (arch_specific->fd, HDIO_GET_IDENTITY, &hdi)) { +@@ -899,11 +902,11 @@ init_ide (PedDevice* dev) + if (!_device_probe_geometry (dev)) + goto error_close_dev; + +- ped_device_close (dev); ++ _device_close (dev); + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1036,7 +1039,7 @@ init_scsi (PedDevice* dev) + char* vendor; + char* product; + +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + if (ioctl (arch_specific->fd, SCSI_IOCTL_GET_IDLUN, &idlun) < 0) { +@@ -1050,7 +1053,7 @@ init_scsi (PedDevice* dev) + goto error_close_dev; + if (!_device_probe_geometry (dev)) + goto error_close_dev; +- ped_device_close (dev); ++ _device_close (dev); + return 1; + } + +@@ -1072,11 +1075,11 @@ init_scsi (PedDevice* dev) + if (!_device_probe_geometry (dev)) + goto error_close_dev; + +- ped_device_close (dev); ++ _device_close (dev); + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1088,7 +1091,7 @@ init_file (PedDevice* dev) + + if (!_device_stat (dev, &dev_stat)) + goto error; +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + dev->sector_size = PED_SECTOR_SIZE_DEFAULT; +@@ -1115,7 +1118,7 @@ init_file (PedDevice* dev) + goto error_close_dev; + } + +- ped_device_close (dev); ++ _device_close (dev); + + dev->bios_geom.cylinders = dev->length / 4 / 32; + dev->bios_geom.heads = 4; +@@ -1126,7 +1129,7 @@ init_file (PedDevice* dev) + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1142,7 +1145,7 @@ init_dasd (PedDevice* dev, const char* model_name) + if (!_device_stat (dev, &dev_stat)) + goto error; + +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); +@@ -1182,11 +1185,11 @@ init_dasd (PedDevice* dev, const char* model_name) + + dev->model = strdup (model_name); + +- ped_device_close (dev); ++ _device_close (dev); + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1201,7 +1204,7 @@ init_generic (PedDevice* dev, const char* model_name) + if (!_device_stat (dev, &dev_stat)) + goto error; + +- if (!ped_device_open (dev)) ++ if (!_device_open_ro (dev)) + goto error; + + ped_exception_fetch_all (); +@@ -1249,11 +1252,11 @@ init_generic (PedDevice* dev, const char* model_name) + + dev->model = strdup (model_name); + +- ped_device_close (dev); ++ _device_close (dev); + return 1; + + error_close_dev: +- ped_device_close (dev); ++ _device_close (dev); + error: + return 0; + } +@@ -1543,12 +1546,27 @@ retry: + } + + static int ++_device_open_ro (PedDevice* dev) ++{ ++ int rc = _device_open (dev, RD_MODE); ++ if (rc) ++ dev->open_count++; ++ return rc; ++} ++ ++static int + linux_open (PedDevice* dev) + { ++ return _device_open (dev, RW_MODE); ++} ++ ++static int ++_device_open (PedDevice* dev, int flags) ++{ + LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev); + + retry: +- arch_specific->fd = open (dev->path, RW_MODE); ++ arch_specific->fd = open (dev->path, flags); + + if (arch_specific->fd == -1) { + char* rw_error_msg = strerror (errno); +@@ -1617,6 +1635,15 @@ linux_refresh_close (PedDevice* dev) + return 1; + } + ++static int ++_device_close (PedDevice* dev) ++{ ++ int rc = linux_close (dev); ++ if (dev->open_count > 0) ++ dev->open_count--; ++ return rc; ++} ++ + #if SIZEOF_OFF_T < 8 + + static _syscall5(int,_llseek, +-- +2.4.3 + diff --git a/SOURCES/0034-tests-Use-wait_for_dev_to_-functions.patch b/SOURCES/0034-tests-Use-wait_for_dev_to_-functions.patch new file mode 100644 index 0000000..a2e8563 --- /dev/null +++ b/SOURCES/0034-tests-Use-wait_for_dev_to_-functions.patch @@ -0,0 +1,145 @@ +From 4182428d60496b7fe61f0599156f871e3cd63f89 Mon Sep 17 00:00:00 2001 +From: "Brian C. Lane" +Date: Fri, 7 Aug 2015 11:43:17 -0700 +Subject: [PATCH 34/35] tests: Use wait_for_dev_to_ functions + +Recent changes to udev have made some long-standing problems appear more +frequently. udev executes various actions when changes are made to +devices. Sometimes this can result in device nodes not appearing +immediately. Other times it can result in EBUSY being returned. This +patch only addresses devices that are slow to appear/disappear. + +It is best to use the wait_for_dev_to_appear_ and +wait_for_dev_to_disappear_ functions than to test for existance. These +will loop and wait for up to 2 seconds for it to appear. + +This also changes t9041 to fail if mkfs doesn't work since using skip +here may hide cases when the device node doesn't appear. + +Related: rhbz#1245144 +--- + tests/t1100-busy-label.sh | 10 ++-------- + tests/t6001-psep.sh | 4 ++-- + tests/t6002-dm-many-partitions.sh | 6 ++---- + tests/t6004-dm-512b-sectors.sh | 1 + + tests/t6100-mdraid-partitions.sh | 5 +++-- + tests/t9041-undetected-in-use-16th-partition.sh | 2 +- + 6 files changed, 11 insertions(+), 17 deletions(-) + +diff --git a/tests/t1100-busy-label.sh b/tests/t1100-busy-label.sh +index 9e371da..93229a7 100755 +--- a/tests/t1100-busy-label.sh ++++ b/tests/t1100-busy-label.sh +@@ -27,22 +27,16 @@ dev=$(cat dev-name) + + parted -s "$dev" mklabel msdos mkpart primary fat32 1 40 > out 2>&1 || fail=1 + compare /dev/null out || fail=1 +-mkfs.vfat ${dev}1 || skip_ "mkfs.vfat failed" ++wait_for_dev_to_appear_ ${dev}1 || fail=1 ++mkfs.vfat ${dev}1 || fail=1 + + mount_point="`pwd`/mnt" + + # Be sure to unmount upon interrupt, failure, etc. + cleanup_fn_() { umount "${dev}1" > /dev/null 2>&1; } + +-# There's a race condition here: on udev-based systems, the partition#1 +-# device, ${dev}1 (i.e., /dev/sdd1) is not created immediately, and +-# without some delay, this mount command would fail. Using a flash card +-# as $dev, the loop below typically iterates 7-20 times. +- + # create mount point dir. and mount the just-created partition on it + mkdir $mount_point || fail=1 +-i=0; while :; do test -e "${dev}1" && break; test $i = 90 && break; +- i=$(expr $i + 1); done; + mount "${dev}1" $mount_point || fail=1 + + # now that a partition is mounted, mklabel attempt must fail +diff --git a/tests/t6001-psep.sh b/tests/t6001-psep.sh +index 0c1ab99..b747732 100644 +--- a/tests/t6001-psep.sh ++++ b/tests/t6001-psep.sh +@@ -55,7 +55,7 @@ parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + #make sure device name is correct +-test -e ${dev}p1 || fail=1 ++wait_for_dev_to_appear_ ${dev}p1 || fail=1 + + #repeat on name not ending in a digit + # setup: create a mapping +@@ -67,7 +67,7 @@ parted -s $dev mklabel msdos mkpart primary fat32 1m 5m > out 2>&1 || fail=1 + compare /dev/null out || fail=1 + + #make sure device name is correct +-test -e ${dev}1 || fail=1 ++wait_for_dev_to_appear_ ${dev}1 || fail=1 + + if [ -n "$fail" ]; then + ls /dev/mapper +diff --git a/tests/t6002-dm-many-partitions.sh b/tests/t6002-dm-many-partitions.sh +index 4d08e72..247c9ee 100755 +--- a/tests/t6002-dm-many-partitions.sh ++++ b/tests/t6002-dm-many-partitions.sh +@@ -49,10 +49,8 @@ parted -m -a min -s /dev/mapper/$dm_name mklabel gpt $cmd > /dev/null 2>&1 || fa + + # Make sure all the partitions appeared under /dev/mapper/ + for ((i=1; i<=$n_partitions; i+=1)); do +- if [ ! -e "/dev/mapper/${dm_name}p$i" ]; then +- fail=1 +- break +- fi ++ wait_for_dev_to_appear_ "/dev/mapper/${dm_name}p$i" || { fail=1; break; } ++ + # remove the partitions as we go, otherwise cleanup won't work. + dmsetup remove /dev/mapper/${dm_name}p$i + done +diff --git a/tests/t6004-dm-512b-sectors.sh b/tests/t6004-dm-512b-sectors.sh +index 31abba9..c3045af 100644 +--- a/tests/t6004-dm-512b-sectors.sh ++++ b/tests/t6004-dm-512b-sectors.sh +@@ -60,6 +60,7 @@ dev="/dev/mapper/$linear_" + # Create msdos partition table with a partition from 1MiB to 100MiB + parted -s $dev mklabel msdos mkpart primary ext2 1MiB 101MiB > out 2>&1 || fail=1 + compare /dev/null out || fail=1 ++wait_for_dev_to_appear_ ${dev}1 || fail=1 + + # The size of the partition should be 100MiB, or 204800 512b sectors + p1_size=$(blockdev --getsz ${dev}1) || framework_failure +diff --git a/tests/t6100-mdraid-partitions.sh b/tests/t6100-mdraid-partitions.sh +index aedf69b..d7e7d6a 100755 +--- a/tests/t6100-mdraid-partitions.sh ++++ b/tests/t6100-mdraid-partitions.sh +@@ -54,13 +54,14 @@ parted -s $md_dev mklabel gpt \ + compare /dev/null out || fail=1 + + # Verify that kernel has been informed about the second device. +-grep "${md_name}p2" /proc/partitions || { fail=1; cat /proc/partitions; } ++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 + compare /dev/null out || fail=1 + + # Verify that kernel has been informed about those removals. +-grep "${md_name}p[12]" /proc/partitions && { fail=1; cat /proc/partitions; } ++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; } + + Exit $fail +diff --git a/tests/t9041-undetected-in-use-16th-partition.sh b/tests/t9041-undetected-in-use-16th-partition.sh +index 6ddc7d8..0b22b0e 100644 +--- a/tests/t9041-undetected-in-use-16th-partition.sh ++++ b/tests/t9041-undetected-in-use-16th-partition.sh +@@ -72,7 +72,7 @@ wait_for_dev_to_appear_ ${scsi_dev}16 || fail_ ${scsi_dev}16 did not appear + + partitions="${scsi_dev}14 ${scsi_dev}15 ${scsi_dev}16" + for i in $partitions; do +- mkfs.ext3 $i || skip_ mkfs.ext3 $i failed ++ mkfs.ext3 $i || fail=1 + done + + # be sure to unmount upon interrupt, failure, etc. +-- +2.4.3 + diff --git a/SPECS/parted.spec b/SPECS/parted.spec index 3bd638e..328941d 100644 --- a/SPECS/parted.spec +++ b/SPECS/parted.spec @@ -4,7 +4,7 @@ Summary: The GNU disk partition manipulation program Name: parted Version: 3.1 -Release: 20%{?dist} +Release: 23%{?dist} License: GPLv3+ Group: Applications/System URL: http://www.gnu.org/software/parted @@ -45,6 +45,11 @@ Patch26: 0026-Update-manpage-NAME-so-whatis-will-work-948424.patch Patch27: 0027-GPT-add-support-for-PReP-GUID-1108196.patch Patch28: 0028-libparted-reread-part-table-with-0-partitions-113846.patch Patch29: 0029-tests-Change-minimum-size-to-256MiB.patch +Patch30: 0030-libparted-handle-logical-partitions-starting-immedia.patch +Patch31: 0031-tests-Add-a-test-for-device-mapper-partition-sizes-1.patch +Patch32: 0032-libparted-device-mapper-uses-512b-sectors-1188431.patch +Patch33: 0033-libparted-Use-read-only-when-probing-devices-on-linu.patch +Patch34: 0034-tests-Use-wait_for_dev_to_-functions.patch Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: e2fsprogs-devel @@ -180,6 +185,22 @@ fi %changelog +* Wed Aug 05 2015 Brian C. Lane 3.1-23 +- libparted: Use read only when probing devices on linux + Resolves: rhbz#1245144 +- tests: Use wait_for_dev_to_ functions + Related: rhbz#1245144 + +* Wed May 20 2015 Brian C. Lane 3.1-22 +- Use 512b sector size when communicating with device-mapper + Resolves: rhbz#1188431 +- Add a test to make sure partitions are the correct size on device-mapper + Related: rhbz#1188431 + +* Thu Apr 16 2015 Brian C. Lane 3.1-21 +- Backport fix for 1 sector logical partition separation from start of extended + Resolves: rhbz#1212323 + * Tue Nov 25 2014 Brian C. Lane 3.1-20 - t1700-fs test: Change minimum size to 256MiB Resolves: rhbz#1167785