parted/libparted-use-BLKRRPART-for-DASD.patch.patch
Marcus Meissner 5631eac2bb 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 13:40:37 +00:00

81 lines
3.0 KiB
Diff

From: Petr Uzel <petr.uzel@suse.cz>
Date: Fri, 14 Feb 2014 09:12:47 +0100
Subject: libparted: use BLKRRPART for DASDs
References: bnc#862139
Patch-mainline: no, upstream dropped proper DASD support
This reverts upstream commit 9fa0e1800db5b9f094ae481fd95a51da03f19e95.
This reverts upstream commit 1223b9fc07859cb619c80dc057bd05458f9b5669.
and some fixups on top
---
libparted/arch/linux.c | 50 ++++++++++++++++++++++++++++++++++++++++---------
1 file changed, 41 insertions(+), 9 deletions(-)
Index: parted-3.3/libparted/arch/linux.c
===================================================================
--- parted-3.3.orig/libparted/arch/linux.c
+++ parted-3.3/libparted/arch/linux.c
@@ -3239,6 +3239,34 @@ _disk_sync_part_table (PedDisk* disk)
}
static int
+_kernel_reread_part_table (PedDevice* dev)
+{
+ LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
+ int retry_count = 9;
+
+ sync();
+ while (ioctl (arch_specific->fd, BLKRRPART)) {
+ retry_count--;
+ sync();
+ if (retry_count == 3)
+ sleep(1); /* Pause to allow system to settle */
+
+ if (!retry_count) {
+ ped_exception_throw (
+ PED_EXCEPTION_WARNING,
+ PED_EXCEPTION_IGNORE,
+ _("WARNING: the kernel failed to re-read the partition "
+ "table on %s (%s). As a result, it may not "
+ "reflect all of your changes until after reboot."),
+ dev->path, strerror (errno));
+ return 0;
+ }
+ }
+
+ return 1;
+}
+
+static int
_have_blkpg ()
{
static int have_blkpg = -1;
@@ -3257,14 +3285,19 @@ linux_disk_commit (PedDisk* disk)
{
if (disk->dev->type != PED_DEVICE_FILE) {
- /* We now require BLKPG support. If this assertion fails,
- please write to the mailing list describing your system.
- Assuming it's never triggered, ...
- FIXME: remove this assertion in 2012. */
- assert (_have_blkpg ());
-
- if (!_disk_sync_part_table (disk))
- return 0;
+ /* The ioctl() command BLKPG_ADD_PARTITION does not notify
+ * the devfs system; consequently, /proc/partitions will not
+ * be up to date, and the proper links in /dev are not
+ * created. Therefore, if using DevFS, we must get the kernel
+ * to re-read and grok the partition table.
+ */
+ /* Work around kernel dasd problem so we really do BLKRRPART */
+ if (disk->dev->type == PED_DEVICE_DASD)
+ return _kernel_reread_part_table(disk->dev);
+
+ assert(_have_blkpg());
+ if (!_disk_sync_part_table(disk))
+ return 0;
}
return 1;