forked from pool/parted
- 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
77 lines
2.7 KiB
Diff
77 lines
2.7 KiB
Diff
From: Petr Uzel <petr.uzel@suse.cz>
|
|
Subject: parted: Make informing the kernel more reliable
|
|
References: bnc#657360
|
|
Patch-mainline: no
|
|
|
|
This patch should make parted's process of informing the kernel
|
|
about changes of partition table sligtly more reliable.
|
|
It consists of 2 quite unrelated parts:
|
|
|
|
* increase the max sleep time if partition is busy from 1 to 2 seconds
|
|
* do not inform the kernel when only partition flags change - kernel
|
|
does not care about the flags
|
|
---
|
|
libparted/arch/linux.c | 2 +-
|
|
parted/parted.c | 28 +++++++++++++++++++++++++++-
|
|
2 files changed, 28 insertions(+), 2 deletions(-)
|
|
|
|
Index: parted-3.3/libparted/arch/linux.c
|
|
===================================================================
|
|
--- parted-3.3.orig/libparted/arch/linux.c
|
|
+++ parted-3.3/libparted/arch/linux.c
|
|
@@ -3153,7 +3153,7 @@ _disk_sync_part_table (PedDisk* disk)
|
|
/* Attempt to remove the partition, retrying for
|
|
up to max_sleep_seconds upon any failure due to EBUSY. */
|
|
unsigned int sleep_microseconds = 10000;
|
|
- unsigned int max_sleep_seconds = 1;
|
|
+ unsigned int max_sleep_seconds = 2;
|
|
unsigned int n_sleep = (max_sleep_seconds
|
|
* 1000000 / sleep_microseconds);
|
|
do {
|
|
Index: parted-3.3/parted/parted.c
|
|
===================================================================
|
|
--- parted-3.3.orig/parted/parted.c
|
|
+++ parted-3.3/parted/parted.c
|
|
@@ -267,6 +267,32 @@ _disk_warn_loss (PedDisk* disk)
|
|
disk->dev->path) == PED_EXCEPTION_YES;
|
|
}
|
|
|
|
+/*
|
|
+ * Copied from ped_disk_commit(), but with removed the call to
|
|
+ * ped_disk_commit_to_os(). This is used in do_set() - BLKPG* ioctls() do not
|
|
+ * care about the partition flags anyway.
|
|
+ */
|
|
+static int
|
|
+ped_disk_commit_just_to_disk (PedDisk* disk)
|
|
+{
|
|
+ /* Open the device here, so that the underlying fd is not closed
|
|
+ between commit_to_dev and commit_to_os (closing causes unwanted
|
|
+ udev events to be sent under Linux). */
|
|
+ if (!ped_device_open (disk->dev))
|
|
+ goto error;
|
|
+
|
|
+ if (!ped_disk_commit_to_dev (disk))
|
|
+ goto error_close_dev;
|
|
+
|
|
+ ped_device_close (disk->dev);
|
|
+ return 1;
|
|
+
|
|
+error_close_dev:
|
|
+ ped_device_close (disk->dev);
|
|
+error:
|
|
+ return 0;
|
|
+}
|
|
+
|
|
/* This function changes "sector" to "new_sector" if the new value lies
|
|
* within the required range.
|
|
*/
|
|
@@ -1791,7 +1817,7 @@ do_set (PedDevice** dev, PedDisk **diskp
|
|
|
|
if (!ped_partition_set_flag (part, flag, state))
|
|
goto error;
|
|
- if (!ped_disk_commit (*diskp))
|
|
+ if (!ped_disk_commit_just_to_disk (*diskp))
|
|
goto error;
|
|
|
|
if ((*dev)->type != PED_DEVICE_FILE)
|