Accepting request 55312 from Base:System

Accepted submit request 55312 from user puzel

OBS-URL: https://build.opensuse.org/request/show/55312
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/parted?expand=0&rev=57
This commit is contained in:
Marcus Rückert 2010-12-10 15:13:23 +00:00 committed by Git OBS Bridge
commit f49fe016af
3 changed files with 86 additions and 0 deletions

View File

@ -0,0 +1,78 @@
# 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 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: parted-2.3/libparted/arch/linux.c
===================================================================
--- parted-2.3.orig/libparted/arch/linux.c
+++ parted-2.3/libparted/arch/linux.c
@@ -2460,10 +2460,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-2.3/parted/parted.c
===================================================================
--- parted-2.3.orig/parted/parted.c
+++ parted-2.3/parted/parted.c
@@ -272,6 +272,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.
*/
@@ -2200,7 +2226,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);

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Thu Dec 9 09:44:33 UTC 2010 - puzel@novell.com
- add more-reliable-informing-the-kernel.patch (bnc#657360)
-------------------------------------------------------------------
Tue Nov 9 12:16:04 UTC 2010 - puzel@novell.com

View File

@ -38,6 +38,8 @@ Patch8: parted-gpt-mbr-sync.patch
Patch10: fix-dm-partition-name.patch
#PATCH-FEATURE-OPENSUSE do-not-create-dm-nodes.patch bnc#501773 petr.uzel@suse.cz
Patch11: do-not-create-dm-nodes.patch
#PATCH-FEATURE-OPENSUSE more-reliable-informing-the-kernel.patch bnc#657360 petr.uzel@suse.cz
Patch12: more-reliable-informing-the-kernel.patch
Requires: /sbin/udevadm
BuildRequires: check-devel
@ -101,6 +103,7 @@ to develop applications that require these.
%patch8
%patch10 -p1
%patch11 -p1
%patch12 -p1
%build
AUTOPOINT=true autoreconf --force --install