Package: udisks Version: 1.0.4-2 Severity: normal Tags: patch When creating a logical partition right after creating the extended one, udisks (udisks-helper-create-partition) returns with a "Device or resource busy" error.
Forcing the kernel to reread the partition table right after extended partition creation seems to do the trick. Here is the thread, which led me to this conclusion: http://www.fedoraforum.org/forum/showthread.php?t=267085 And a similar bug in Ubuntu: https://bugs.launchpad.net/ubuntu/+source/gnome-disk-utility/+bug/666038 A proposed (tested to some extent) patch attached. -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (600, 'testing'), (500, 'stable-updates'), (500, 'stable'), (50, 'unstable') Architecture: i386 (i686) Kernel: Linux 3.1.0-1-686-pae (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages udisks depends on: ii dbus 1.4.16-1 ii libatasmart4 0.18-1 ii libc6 2.13-21 ii libdbus-1-3 1.4.16-1 ii libdbus-glib-1-2 0.98-1 ii libdevmapper1.02.1 2:1.02.67-2 ii libglib2.0-0 2.30.2-4 ii libgudev-1.0-0 175-3 ii liblvm2app2.2 2.02.88-2 ii libparted0debian1 2.3-8 ii libpolkit-gobject-1-0 0.103-1 ii libsgutils2-2 1.32-1 ii libudev0 175-3 ii udev 175-3 Versions of packages udisks recommends: ii dosfstools 3.0.12-1 ii eject 2.1.5+deb1+cvs20081104-9 ii hdparm 9.32-1 ii mtools 4.0.12-1 ii ntfs-3g [ntfsprogs] 1:2011.10.9AR.1-1 ii policykit-1 0.103-1 Versions of packages udisks suggests: pn cryptsetup 2:1.3.0-3 pn mdadm 3.2.2-1 pn reiserfsprogs <none> pn xfsprogs <none> -- no debconf information
>From 7bc0771e7f63c8c42d817cca3fef16a7a6c4fdf0 Mon Sep 17 00:00:00 2001 From: Marcin Szewczyk <marcin.szewc...@wodny.org> Date: Thu, 22 Dec 2011 16:25:02 +0100 Subject: [PATCH] BLKRRPART instead of BLKPG for extended partitions Use BLKRRPART instead of BLKPG after creating an extended partition. BLKPG returns with the "Device or resource busy" error. --- src/helpers/job-create-partition.c | 48 +++++++++++++++++++++++------------ 1 files changed, 31 insertions(+), 17 deletions(-) diff --git a/src/helpers/job-create-partition.c b/src/helpers/job-create-partition.c index 80277b8..818309b 100644 --- a/src/helpers/job-create-partition.c +++ b/src/helpers/job-create-partition.c @@ -141,25 +141,39 @@ main (int argc, g_printerr ("Cannot open %s: %m\n", device); goto out; } - memset (&a, '\0', sizeof(struct blkpg_ioctl_arg)); - memset (&p, '\0', sizeof(struct blkpg_partition)); - p.pno = out_num; - p.start = out_start; - p.length = out_size; - a.op = BLKPG_ADD_PARTITION; - a.datalen = sizeof(p); - a.data = &p; - if (ioctl (fd, BLKPG, &a) == -1) + + if (*endp == '\0' && (n == 0x05 || n == 0x0f || n == 0x85)) { - g_printerr ("Error doing BLKPG ioctl with BLKPG_ADD_PARTITION for partition %d " - "of size %" G_GUINT64_FORMAT " at offset %" G_GUINT64_FORMAT " on %s: %m\n", - out_num, - out_start, - out_size, - device); - close (fd); - goto out; + if (ioctl (fd, BLKRRPART) == -1) + { + g_printerr ("Error doing BLKRRPART ioctl on %s: %m\n", + device); + close (fd); + goto out; + } } + else + { + memset (&a, '\0', sizeof(struct blkpg_ioctl_arg)); + memset (&p, '\0', sizeof(struct blkpg_partition)); + p.pno = out_num; + p.start = out_start; + p.length = out_size; + a.op = BLKPG_ADD_PARTITION; + a.datalen = sizeof(p); + a.data = &p; + if (ioctl (fd, BLKPG, &a) == -1) + { + g_printerr ("Error doing BLKPG ioctl with BLKPG_ADD_PARTITION for partition %d " + "of size %" G_GUINT64_FORMAT " at offset %" G_GUINT64_FORMAT " on %s: %m\n", + out_num, + out_start, + out_size, + device); + close (fd); + goto out; + } + } close (fd); } -- 1.7.7.3