diff --git a/avoid-unnecessary-open-close.patch b/avoid-unnecessary-open-close.patch deleted file mode 100644 index 1c6762b..0000000 --- a/avoid-unnecessary-open-close.patch +++ /dev/null @@ -1,61 +0,0 @@ -From ad25892bb995f61b0ddf801ed1f74e0b1e7390ce Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Thu, 27 Aug 2009 20:16:09 +0200 -Subject: [PATCH] parted: avoid unnecessary open/close on commit, and thus udev activity - -* libparted/disk.c (ped_disk_commit): Open/close the underlying file -descriptor in this function, so that callees, ped_disk_commit_to_dev -and ped_disk_commit_to_os do not each perform open/close syscalls. -This saves an open/close pair, and thus avoids unneeded udev -activity on Linux. - -Before this change, when calling commit() on a ped_disk, the -following would happen: - -open /dev/sda -write partition table -close /dev/sda -open /dev/sda -ioctl (BLKRRPART) -close /dev/sda - -This is rather inefficient, and causes 2 udev change events to be fired -for /dev/sda (+ the change events from the BLKRRPART), causing all kind -of scanning (blkid & friends) twice. - -This patch fixes things to only open the device once. ---- - libparted/disk.c | 20 ++++++++++++++++++-- - 1 files changed, 18 insertions(+), 2 deletions(-) - -Index: parted-1.9.0/libparted/disk.c -=================================================================== ---- parted-1.9.0.orig/libparted/disk.c 2009-12-03 15:09:44.000000000 +0100 -+++ parted-1.9.0/libparted/disk.c 2009-12-03 15:10:13.000000000 +0100 -@@ -489,9 +489,25 @@ error: - int - ped_disk_commit (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; -+ -+ if (!ped_disk_commit_to_os (disk)) -+ goto error_close_dev; -+ -+ ped_device_close (disk->dev); -+ return 1; -+ -+error_close_dev: -+ ped_device_close (disk->dev); -+error: - return 0; -- return ped_disk_commit_to_os (disk); - } - - /** diff --git a/do-not-unnecessarily-open-part-dev.patch b/do-not-unnecessarily-open-part-dev.patch deleted file mode 100644 index e1cacf4..0000000 --- a/do-not-unnecessarily-open-part-dev.patch +++ /dev/null @@ -1,96 +0,0 @@ -From 2a6936fab4d4499a4b812dd330d3db50549029e0 Mon Sep 17 00:00:00 2001 -From: Hans de Goede -Date: Fri, 28 Aug 2009 17:05:55 +0200 -Subject: [PATCH] linux-commit: do not unnecessarily open partition device nodes - -After patching parted with my do-not-use-BLKPG patch, I started -to get EBUSY errors on commit_to_os. Note this is not caused -by the do-not-use-BLKPG patch, this was already happening, but -parted was silently ignoring the errors (and the kernel was -not notified of the changes, which is bad). The error now -actually gets reported. - -The problem turns out to be in libparted/arch/linux.c's -_flush_cache function, which walks all the partitions of the -disk and does BLKFLSBUF calls on them. This causes the following: - -commit_to_os -> device_open -> fd = open /dev/sda -> -_flush_cache -> for each /dev/sda# open, ioctl, close --> ioctl(fd, BLKRRPART) -> EBUSY - -What is happening here is that the: -for each /dev/sda# open, ioctl, close - -Is causing udev change events for all the /dev/sda# -nodes, which causes udev to call blkid on all these nodes -(on systems which use DeviceKit), so blkid has /dev/sda# nodes -open while BLKRRPART gets called on /dev/sda -> EBUSY. - -I've checked with two independend storage subsystem kernel -developers, and /dev/sda and /dev/sda#, guarantee cache coherency -now-a-days. So there is no need to do this for 2.6, which also -eliminates the need to call _flush_cache() on device open at all. - -* libparted/arch/linux.c (_have_kern26): New function. -(_flush_cache): For linux kernels 2.6 and newer, don't flush -partition devices. -(linux_open): Skip _flush_cache on newer kernels here, too. ---- - libparted/arch/linux.c | 25 ++++++++++++++++++++++--- - 1 files changed, 22 insertions(+), 3 deletions(-) - -Index: parted-1.9.0/libparted/arch/linux.c -=================================================================== ---- parted-1.9.0.orig/libparted/arch/linux.c 2009-12-03 17:04:44.000000000 +0100 -+++ parted-1.9.0/libparted/arch/linux.c 2009-12-03 17:05:06.000000000 +0100 -@@ -601,6 +601,19 @@ _have_devfs () - return have_devfs = S_ISCHR(sb.st_mode) ? 1 : 0; - } - -+static int -+_have_kern26 () -+{ -+ static int have_kern26 = -1; -+ int kver; -+ -+ if (have_kern26 != -1) -+ return have_kern26; -+ -+ kver = _get_linux_version(); -+ return have_kern26 = kver >= KERNEL_VERSION (2,6,0) ? 1 : 0; -+} -+ - static void - _device_set_sector_size (PedDevice* dev) - { -@@ -1374,8 +1387,8 @@ linux_is_busy (PedDevice* dev) - return 0; - } - --/* we need to flush the master device, and all the partition devices, -- * because there is no coherency between the caches. -+/* we need to flush the master device, and with kernel < 2.6 all the partition -+ * devices, because there is no coherency between the caches with old kernels. - * We should only flush unmounted partition devices, because: - * - there is never a need to flush them (we're not doing IO there) - * - flushing a device that is mounted causes unnecessary IO, and can -@@ -1393,6 +1406,10 @@ _flush_cache (PedDevice* dev) - - ioctl (arch_specific->fd, BLKFLSBUF); - -+ /* With linux-2.6.0 and newer, we're done. */ -+ if (_have_kern26()) -+ return; -+ - for (i = 1; i < 16; i++) { - char* name; - int fd; -@@ -1449,6 +1466,8 @@ retry: - dev->read_only = 0; - } - -+ /* With kernels < 2.6 flush cache for cache coherence issues */ -+ if (!_have_kern26()) - _flush_cache (dev); - - return 1; diff --git a/fix-race-call-udevadm-settle.patch b/fix-race-call-udevadm-settle.patch deleted file mode 100644 index c342a89..0000000 --- a/fix-race-call-udevadm-settle.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- - libparted/arch/linux.c | 4 +++- - 1 file changed, 3 insertions(+), 1 deletion(-) - -Index: parted-1.9.0/libparted/arch/linux.c -=================================================================== ---- parted-1.9.0.orig/libparted/arch/linux.c 2009-12-11 12:04:43.000000000 +0100 -+++ parted-1.9.0/libparted/arch/linux.c 2009-12-11 12:10:22.000000000 +0100 -@@ -2224,7 +2224,9 @@ _blkpg_part_command (PedDevice* dev, str - ioctl_arg.datalen = sizeof (struct blkpg_partition); - ioctl_arg.data = (void*) part; - -- return ioctl (arch_specific->fd, BLKPG, &ioctl_arg) == 0; -+ int ret = (ioctl (arch_specific->fd, BLKPG, &ioctl_arg) == 0); -+ system("/sbin/udevadm settle"); -+ return ret; - } - - static int diff --git a/parted.changes b/parted.changes index f8883ba..8dd96c7 100644 --- a/parted.changes +++ b/parted.changes @@ -1,10 +1,3 @@ -------------------------------------------------------------------- -Thu Dec 3 14:10:59 UTC 2009 - puzel@novell.com - -- avoid-unnecessary-open-close.patch, - do-not-unnecessarily-open-part-dev.patch, - fix-race-call-udevadm-settle.patch (bnc#539521) - ------------------------------------------------------------------- Wed Oct 7 14:12:15 UTC 2009 - puzel@novell.com diff --git a/parted.spec b/parted.spec index 49ea614..7a4f129 100644 --- a/parted.spec +++ b/parted.spec @@ -28,7 +28,6 @@ BuildRequires: libselinux-devel %define aclocaldir /usr/share/aclocal License: GPL v3 or later Group: System/Filesystems -Requires: /sbin/udevadm Summary: GNU partitioner Version: 1.9.0 Release: 2 @@ -54,12 +53,6 @@ Patch15: fix-dm-partition-name.patch Patch16: fix-tests.sh #PATCH-FEATURE-OPENSUSE do-not-create-dm-nodes.patch bnc#501773 petr.uzel@suse.cz Patch17: do-not-create-dm-nodes.patch -#PATCH-FIX-UPSTREAM avoid-unnecessary-open-close.patch bnc#539521 petr.uzel@suse.cz -Patch18: avoid-unnecessary-open-close.patch -#PATCH-FIX-UPSTREAM do-not-unnecessarily-open-part-dev.patch bnc#539521 petr.uzel@suse.cz -Patch19: do-not-unnecessarily-open-part-dev.patch -#PATCH-FIX-UPSTREAM fix-race-call-udevadm-settle.patch bnc#539521 petr.uzel@suse.cz -Patch20: fix-race-call-udevadm-settle.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Url: http://www.gnu.org/software/parted/ PreReq: %install_info_prereq @@ -120,9 +113,6 @@ Authors: %patch15 -p1 %patch16 -p1 %patch17 -p1 -%patch18 -p1 -%patch19 -p1 -%patch20 -p1 %build AUTOPOINT=true autoreconf --force --install