From 690c04b7af4c5475bc5efc31950fe3bee7762a4e2c4d0800425892674b8c9c0e Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Fri, 11 Dec 2009 16:50:27 +0000 Subject: [PATCH 1/5] fix #539521 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=12 --- parted.spec | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parted.spec b/parted.spec index 4a8059f..49ea614 100644 --- a/parted.spec +++ b/parted.spec @@ -26,12 +26,12 @@ BuildRequires: readline-devel BuildRequires: libsepol-devel BuildRequires: libselinux-devel %define aclocaldir /usr/share/aclocal -License: GPLv3+ +License: GPL v3 or later Group: System/Filesystems Requires: /sbin/udevadm Summary: GNU partitioner Version: 1.9.0 -Release: 3 +Release: 2 Source0: %{name}-%{version}.tar.bz2 Patch0: always-resize-part.dif Patch1: parted-type.patch @@ -77,7 +77,7 @@ Authors: Andrew Clausen %package devel -License: GPLv2+ +License: GPL v2 or later Summary: Parted Include Files and Libraries necessary for Development Group: Development/Libraries/C and C++ Requires: e2fsprogs-devel parted = %version device-mapper-devel libreiserfs-devel From e373e82ffdb79af5b8325977e35bfc9943bfde0e348f0370d899d10cff4fe486 Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Wed, 16 Dec 2009 08:45:26 +0000 Subject: [PATCH 2/5] checked in OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=13 --- avoid-unnecessary-open-close.patch | 61 --------------- do-not-unnecessarily-open-part-dev.patch | 96 ------------------------ fix-race-call-udevadm-settle.patch | 19 ----- parted.changes | 7 -- parted.spec | 10 --- 5 files changed, 193 deletions(-) delete mode 100644 avoid-unnecessary-open-close.patch delete mode 100644 do-not-unnecessarily-open-part-dev.patch delete mode 100644 fix-race-call-udevadm-settle.patch 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 From 1f7315e780b5c327fdb96c92763008c03a71a9a96772905e39c3acac9954ffc4 Mon Sep 17 00:00:00 2001 From: Petr Uzel Date: Tue, 26 Jan 2010 09:03:05 +0000 Subject: [PATCH 3/5] Accepting request 30480 from home:puzel:branches:Base:System Copy from home:puzel:branches:Base:System/parted via accept of submit request 30480 revision 2. Request was accepted with message: OBS-URL: https://build.opensuse.org/request/show/30480 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=14 --- avoid-unnecessary-open-close.patch | 61 +++++++++++++++ do-not-unnecessarily-open-part-dev.patch | 96 ++++++++++++++++++++++++ fix-race-call-udevadm-settle.patch | 19 +++++ parted.changes | 13 ++++ parted.spec | 22 +++++- retry-blkpg-ioctl.patch | 22 ++++++ use-ext-range.patch | 22 ++++++ 7 files changed, 252 insertions(+), 3 deletions(-) create mode 100644 avoid-unnecessary-open-close.patch create mode 100644 do-not-unnecessarily-open-part-dev.patch create mode 100644 fix-race-call-udevadm-settle.patch create mode 100644 retry-blkpg-ioctl.patch create mode 100644 use-ext-range.patch diff --git a/avoid-unnecessary-open-close.patch b/avoid-unnecessary-open-close.patch new file mode 100644 index 0000000..1c6762b --- /dev/null +++ b/avoid-unnecessary-open-close.patch @@ -0,0 +1,61 @@ +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 new file mode 100644 index 0000000..e1cacf4 --- /dev/null +++ b/do-not-unnecessarily-open-part-dev.patch @@ -0,0 +1,96 @@ +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 new file mode 100644 index 0000000..c342a89 --- /dev/null +++ b/fix-race-call-udevadm-settle.patch @@ -0,0 +1,19 @@ +--- + 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 8dd96c7..0a1587f 100644 --- a/parted.changes +++ b/parted.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Mon Jan 25 15:54:17 UTC 2010 - puzel@novell.com + +- use-ext-range.patch (bnc#567652) + +------------------------------------------------------------------- +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, + retry-blkpg-ioctl.patch (bnc#539521) + ------------------------------------------------------------------- Wed Oct 7 14:12:15 UTC 2009 - puzel@novell.com diff --git a/parted.spec b/parted.spec index 7a4f129..5229f47 100644 --- a/parted.spec +++ b/parted.spec @@ -26,11 +26,12 @@ BuildRequires: readline-devel BuildRequires: libsepol-devel BuildRequires: libselinux-devel %define aclocaldir /usr/share/aclocal -License: GPL v3 or later +License: GPLv3+ Group: System/Filesystems +Requires: /sbin/udevadm Summary: GNU partitioner Version: 1.9.0 -Release: 2 +Release: 3 Source0: %{name}-%{version}.tar.bz2 Patch0: always-resize-part.dif Patch1: parted-type.patch @@ -53,6 +54,16 @@ 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 +#PATCH-FIX-UPSTREAM retry-blkpg-ioctl.patch bnc#539521 petr.uzel@suse.cz +Patch21: retry-blkpg-ioctl.patch +#PATCH-FIX-UPSTREAM use-ext-range.patch bnc#567652 petr.uzel@suse.cz +Patch22: use-ext-range.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Url: http://www.gnu.org/software/parted/ PreReq: %install_info_prereq @@ -70,7 +81,7 @@ Authors: Andrew Clausen %package devel -License: GPL v2 or later +License: GPLv2+ Summary: Parted Include Files and Libraries necessary for Development Group: Development/Libraries/C and C++ Requires: e2fsprogs-devel parted = %version device-mapper-devel libreiserfs-devel @@ -113,6 +124,11 @@ Authors: %patch15 -p1 %patch16 -p1 %patch17 -p1 +%patch18 -p1 +%patch19 -p1 +%patch20 -p1 +%patch21 -p1 +%patch22 -p1 %build AUTOPOINT=true autoreconf --force --install diff --git a/retry-blkpg-ioctl.patch b/retry-blkpg-ioctl.patch new file mode 100644 index 0000000..c03debb --- /dev/null +++ b/retry-blkpg-ioctl.patch @@ -0,0 +1,22 @@ +Index: parted-1.9.0/libparted/arch/linux.c +=================================================================== +--- parted-1.9.0.orig/libparted/arch/linux.c 2010-01-25 16:24:54.000000000 +0100 ++++ parted-1.9.0/libparted/arch/linux.c 2010-01-25 16:26:35.000000000 +0100 +@@ -2360,8 +2360,17 @@ _disk_sync_part_table (PedDisk* disk) + int i; + + for (i = 1; i <= lpn; i++) { ++ /* try to BLKPG_REMOVE the partition ++ * retry once more after short sleep if EBUSY ++ */ + rets[i - 1] = _blkpg_remove_partition (disk, i); + errnums[i - 1] = errno; ++ ++ if ( !rets[i - 1] && errnums[i - 1] == EBUSY ) { ++ sleep(1); ++ rets[i - 1] = _blkpg_remove_partition (disk, i); ++ errnums[i - 1] = errno; ++ } + } + + for (i = 1; i <= lpn; i++) { diff --git a/use-ext-range.patch b/use-ext-range.patch new file mode 100644 index 0000000..a41d2e7 --- /dev/null +++ b/use-ext-range.patch @@ -0,0 +1,22 @@ +Index: parted-1.9.0/libparted/arch/linux.c +=================================================================== +--- parted-1.9.0.orig/libparted/arch/linux.c 2010-01-25 16:32:09.000000000 +0100 ++++ parted-1.9.0/libparted/arch/linux.c 2010-01-25 16:33:18.000000000 +0100 +@@ -2296,7 +2296,7 @@ _blkpg_remove_partition (PedDisk* disk, + + /* + * The number of partitions that a device can have depends on the kernel. +- * If we don't find this value in /sys/block/DEV/range, we will use our own ++ * If we don't find this value in /sys/block/DEV/ext_range, we will use our own + * value. + */ + static unsigned int +@@ -2307,7 +2307,7 @@ _device_get_partition_range(PedDevice* d + FILE* fp; + bool ok; + +- r = snprintf(path, sizeof(path), "/sys/block/%s/range", ++ r = snprintf(path, sizeof(path), "/sys/block/%s/ext_range", + last_component(dev->path)); + if(r < 0 || r >= sizeof(path)) + return MAX_NUM_PARTS; From f51c98a81cef3a659cb4c078f91c0c74957630a4656ef08fade847b35a21d15b Mon Sep 17 00:00:00 2001 From: OBS User autobuild Date: Wed, 27 Jan 2010 16:34:38 +0000 Subject: [PATCH 4/5] checked in (request 30481) OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=15 --- parted.changes | 8 +------- parted.spec | 6 ------ retry-blkpg-ioctl.patch | 22 ---------------------- use-ext-range.patch | 22 ---------------------- 4 files changed, 1 insertion(+), 57 deletions(-) delete mode 100644 retry-blkpg-ioctl.patch delete mode 100644 use-ext-range.patch diff --git a/parted.changes b/parted.changes index 0a1587f..f8883ba 100644 --- a/parted.changes +++ b/parted.changes @@ -1,15 +1,9 @@ -------------------------------------------------------------------- -Mon Jan 25 15:54:17 UTC 2010 - puzel@novell.com - -- use-ext-range.patch (bnc#567652) - ------------------------------------------------------------------- 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, - retry-blkpg-ioctl.patch (bnc#539521) + 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 5229f47..4a8059f 100644 --- a/parted.spec +++ b/parted.spec @@ -60,10 +60,6 @@ Patch18: avoid-unnecessary-open-close.patch 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 -#PATCH-FIX-UPSTREAM retry-blkpg-ioctl.patch bnc#539521 petr.uzel@suse.cz -Patch21: retry-blkpg-ioctl.patch -#PATCH-FIX-UPSTREAM use-ext-range.patch bnc#567652 petr.uzel@suse.cz -Patch22: use-ext-range.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Url: http://www.gnu.org/software/parted/ PreReq: %install_info_prereq @@ -127,8 +123,6 @@ Authors: %patch18 -p1 %patch19 -p1 %patch20 -p1 -%patch21 -p1 -%patch22 -p1 %build AUTOPOINT=true autoreconf --force --install diff --git a/retry-blkpg-ioctl.patch b/retry-blkpg-ioctl.patch deleted file mode 100644 index c03debb..0000000 --- a/retry-blkpg-ioctl.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: parted-1.9.0/libparted/arch/linux.c -=================================================================== ---- parted-1.9.0.orig/libparted/arch/linux.c 2010-01-25 16:24:54.000000000 +0100 -+++ parted-1.9.0/libparted/arch/linux.c 2010-01-25 16:26:35.000000000 +0100 -@@ -2360,8 +2360,17 @@ _disk_sync_part_table (PedDisk* disk) - int i; - - for (i = 1; i <= lpn; i++) { -+ /* try to BLKPG_REMOVE the partition -+ * retry once more after short sleep if EBUSY -+ */ - rets[i - 1] = _blkpg_remove_partition (disk, i); - errnums[i - 1] = errno; -+ -+ if ( !rets[i - 1] && errnums[i - 1] == EBUSY ) { -+ sleep(1); -+ rets[i - 1] = _blkpg_remove_partition (disk, i); -+ errnums[i - 1] = errno; -+ } - } - - for (i = 1; i <= lpn; i++) { diff --git a/use-ext-range.patch b/use-ext-range.patch deleted file mode 100644 index a41d2e7..0000000 --- a/use-ext-range.patch +++ /dev/null @@ -1,22 +0,0 @@ -Index: parted-1.9.0/libparted/arch/linux.c -=================================================================== ---- parted-1.9.0.orig/libparted/arch/linux.c 2010-01-25 16:32:09.000000000 +0100 -+++ parted-1.9.0/libparted/arch/linux.c 2010-01-25 16:33:18.000000000 +0100 -@@ -2296,7 +2296,7 @@ _blkpg_remove_partition (PedDisk* disk, - - /* - * The number of partitions that a device can have depends on the kernel. -- * If we don't find this value in /sys/block/DEV/range, we will use our own -+ * If we don't find this value in /sys/block/DEV/ext_range, we will use our own - * value. - */ - static unsigned int -@@ -2307,7 +2307,7 @@ _device_get_partition_range(PedDevice* d - FILE* fp; - bool ok; - -- r = snprintf(path, sizeof(path), "/sys/block/%s/range", -+ r = snprintf(path, sizeof(path), "/sys/block/%s/ext_range", - last_component(dev->path)); - if(r < 0 || r >= sizeof(path)) - return MAX_NUM_PARTS; From 4548c4e5ace4abcec02f337b92c22527a66f25ed9ab3ad5fbb3ee9ce36380765 Mon Sep 17 00:00:00 2001 From: OBS User buildservice-autocommit Date: Wed, 27 Jan 2010 16:34:39 +0000 Subject: [PATCH 5/5] Updating link to change in openSUSE:Factory/parted revision 45.0 OBS-URL: https://build.opensuse.org/package/show/Base:System/parted?expand=0&rev=5cc4bfbfddbfa27955f42a59e6b75f56 --- parted.changes | 8 +++++++- parted.spec | 10 ++++++++-- retry-blkpg-ioctl.patch | 22 ++++++++++++++++++++++ use-ext-range.patch | 22 ++++++++++++++++++++++ 4 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 retry-blkpg-ioctl.patch create mode 100644 use-ext-range.patch diff --git a/parted.changes b/parted.changes index f8883ba..0a1587f 100644 --- a/parted.changes +++ b/parted.changes @@ -1,9 +1,15 @@ +------------------------------------------------------------------- +Mon Jan 25 15:54:17 UTC 2010 - puzel@novell.com + +- use-ext-range.patch (bnc#567652) + ------------------------------------------------------------------- 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) + fix-race-call-udevadm-settle.patch, + retry-blkpg-ioctl.patch (bnc#539521) ------------------------------------------------------------------- Wed Oct 7 14:12:15 UTC 2009 - puzel@novell.com diff --git a/parted.spec b/parted.spec index 4a8059f..fc4174c 100644 --- a/parted.spec +++ b/parted.spec @@ -1,7 +1,7 @@ # # spec file for package parted (Version 1.9.0) # -# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. +# Copyright (c) 2010 SUSE LINUX Products GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -31,7 +31,7 @@ Group: System/Filesystems Requires: /sbin/udevadm Summary: GNU partitioner Version: 1.9.0 -Release: 3 +Release: 4 Source0: %{name}-%{version}.tar.bz2 Patch0: always-resize-part.dif Patch1: parted-type.patch @@ -60,6 +60,10 @@ Patch18: avoid-unnecessary-open-close.patch 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 +#PATCH-FIX-UPSTREAM retry-blkpg-ioctl.patch bnc#539521 petr.uzel@suse.cz +Patch21: retry-blkpg-ioctl.patch +#PATCH-FIX-UPSTREAM use-ext-range.patch bnc#567652 petr.uzel@suse.cz +Patch22: use-ext-range.patch BuildRoot: %{_tmppath}/%{name}-%{version}-build Url: http://www.gnu.org/software/parted/ PreReq: %install_info_prereq @@ -123,6 +127,8 @@ Authors: %patch18 -p1 %patch19 -p1 %patch20 -p1 +%patch21 -p1 +%patch22 -p1 %build AUTOPOINT=true autoreconf --force --install diff --git a/retry-blkpg-ioctl.patch b/retry-blkpg-ioctl.patch new file mode 100644 index 0000000..c03debb --- /dev/null +++ b/retry-blkpg-ioctl.patch @@ -0,0 +1,22 @@ +Index: parted-1.9.0/libparted/arch/linux.c +=================================================================== +--- parted-1.9.0.orig/libparted/arch/linux.c 2010-01-25 16:24:54.000000000 +0100 ++++ parted-1.9.0/libparted/arch/linux.c 2010-01-25 16:26:35.000000000 +0100 +@@ -2360,8 +2360,17 @@ _disk_sync_part_table (PedDisk* disk) + int i; + + for (i = 1; i <= lpn; i++) { ++ /* try to BLKPG_REMOVE the partition ++ * retry once more after short sleep if EBUSY ++ */ + rets[i - 1] = _blkpg_remove_partition (disk, i); + errnums[i - 1] = errno; ++ ++ if ( !rets[i - 1] && errnums[i - 1] == EBUSY ) { ++ sleep(1); ++ rets[i - 1] = _blkpg_remove_partition (disk, i); ++ errnums[i - 1] = errno; ++ } + } + + for (i = 1; i <= lpn; i++) { diff --git a/use-ext-range.patch b/use-ext-range.patch new file mode 100644 index 0000000..a41d2e7 --- /dev/null +++ b/use-ext-range.patch @@ -0,0 +1,22 @@ +Index: parted-1.9.0/libparted/arch/linux.c +=================================================================== +--- parted-1.9.0.orig/libparted/arch/linux.c 2010-01-25 16:32:09.000000000 +0100 ++++ parted-1.9.0/libparted/arch/linux.c 2010-01-25 16:33:18.000000000 +0100 +@@ -2296,7 +2296,7 @@ _blkpg_remove_partition (PedDisk* disk, + + /* + * The number of partitions that a device can have depends on the kernel. +- * If we don't find this value in /sys/block/DEV/range, we will use our own ++ * If we don't find this value in /sys/block/DEV/ext_range, we will use our own + * value. + */ + static unsigned int +@@ -2307,7 +2307,7 @@ _device_get_partition_range(PedDevice* d + FILE* fp; + bool ok; + +- r = snprintf(path, sizeof(path), "/sys/block/%s/range", ++ r = snprintf(path, sizeof(path), "/sys/block/%s/ext_range", + last_component(dev->path)); + if(r < 0 || r >= sizeof(path)) + return MAX_NUM_PARTS;