parted/more-reliable-informing-the-kernel.patch
Petr Uzel b5a4ceef04 - update to parted-3.1 (fate#316110)
- changes in parted-3.1:
  * Changes in behavior
    - Floppy drives are no longer scanned on linux: they cannot be
      partitioned anyhow, and some users have a misconfigured BIOS
      that claims to have a floppy when they don't, and scanning
      gets hung up.
    - parted: the mkpart command has changed semantics with regard
      to specifying the end of the partition.  If the end is
      specified using units of MiB, GiB, etc., parted subtracts one
      sector from the specified value.  With this change, it is now
      possible to create partitions like 1MiB-2MiB, 2MiB-3MiB and
      so on.
  * Many bugfixes (see changelog)
- changes in parted-3.0:
  * Changes in behavior
    - Remove all FS-related (file system-related) sub-commands;
      these commands are no longer recognized because they were all
      dependent on parted "knowing" too much about file system:
      mkpartfs, mkfs, cp, move, check.
    - 'resize' command changed semantics:
      it no longer resizes the filesystem, but only moves end
      sector of the partition
- libparted-devel contains libparted-fs-resize library 
- add ability to change size of the partition (ignoring contained
  filesystem) with 'resize' command; this command has different
  semantics than the former 'resize' command which upstream
  decided to drop
  - parted-resize-command.patch (fate#316110)
- when using syncmbr on POWER, make the first partition type 0x41

OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=79
2014-01-09 16:35:35 +00:00

80 lines
2.7 KiB
Diff

# bnc#657360
#
# This patch should make parted's process of informing the kernel
# about changes of partition table sligtly more reliable.
# It consists of 3 quite unrelated parts:
#
# 1. increase the max sleep time if partition is busy from 1 to 2 seconds
# 2. do not inform the kernel when only partition flags change - kernel
# does not care about the flags
# 3. call 'udevadm settle' before doing BLKPG_DEL_PARTITION ioctl()
---
libparted/arch/linux.c | 4 +++-
parted/parted.c | 28 +++++++++++++++++++++++++++-
2 files changed, 30 insertions(+), 2 deletions(-)
Index: parted-3.1/libparted/arch/linux.c
===================================================================
--- parted-3.1.orig/libparted/arch/linux.c
+++ parted-3.1/libparted/arch/linux.c
@@ -2585,10 +2585,12 @@ _disk_sync_part_table (PedDisk* disk)
if (!errnums)
goto cleanup;
+ system("/sbin/udevadm settle --timeout=20");
+
/* Attempt to remove each and every 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);
int i;
Index: parted-3.1/parted/parted.c
===================================================================
--- parted-3.1.orig/parted/parted.c
+++ parted-3.1/parted/parted.c
@@ -258,6 +258,32 @@ _disk_warn_loss (PedDisk* disk)
disk->dev->path) == PED_EXCEPTION_YES;
}
+/*
+ * Copied from ped_disk_commit() but removed the ped_disk_commit_to_os. We use
+ * this function in do_set - BLKPG* ioctls() does 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.
*/
@@ -1643,7 +1669,7 @@ do_set (PedDevice** dev)
if (!ped_partition_set_flag (part, flag, state))
goto error_destroy_disk;
- if (!ped_disk_commit (disk))
+ if (!ped_disk_commit_just_to_disk (disk))
goto error_destroy_disk;
ped_disk_destroy (disk);