Bug#502618: partman: /dev/mapper/vg0-home is apparently in use by the system
On Tue, Oct 21, 2008 at 09:02:57PM +0200, Frans Pop wrote:
> On Tuesday 21 October 2008, Colin Watson wrote:
> > That may be the proximate cause, but at most it's just exposing
> > breakage elsewhere. The actual incorrect code is in libparted itself,
> > not parted_server. It should not be generating "p1"-type device names
> > for LVM logical volumes.
>
> Problem is that we're this -><- close to a release. If someone wants to
> investigate the real cause: please do, but it'll have to be fast.
> In absence of a volunteer to do that I would suggest fixing the regression
> by a revert.
Maybe something like this?
--
Colin Watson [cjwatson@debian.org]
#! /bin/sh /usr/share/dpatch/dpatch-run
## unpartitioned-disks.dpatch by Colin Watson <cjwatson@ubuntu.com>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Don't try to call BLKPG ioctls or tell device-mapper to create
## DP: partitions on disks that can't be partitioned.
@DPATCH@
diff -urNad parted-1.8.8.git.2008.03.24~/libparted/arch/linux.c parted-1.8.8.git.2008.03.24/libparted/arch/linux.c
--- parted-1.8.8.git.2008.03.24~/libparted/arch/linux.c 2008-07-10 02:05:20.000000000 +0100
+++ parted-1.8.8.git.2008.03.24/libparted/arch/linux.c 2008-07-10 13:51:09.000000000 +0100
@@ -2102,6 +2102,18 @@
}
static int
+_has_partitions (const PedDisk* disk)
+{
+ PED_ASSERT(disk != NULL, return 0);
+
+ /* Some devices can't be partitioned. */
+ if (!strcmp (disk->type->name, "loop"))
+ return 0;
+
+ return 1;
+}
+
+static int
_blkpg_part_command (PedDevice* dev, struct blkpg_partition* part, int op)
{
LinuxSpecific* arch_specific = LINUX_SPECIFIC (dev);
@@ -2126,6 +2138,9 @@
PED_ASSERT(disk->dev->sector_size % PED_SECTOR_SIZE_DEFAULT == 0,
return 0);
+ if (!_has_partitions (disk))
+ return 0;
+
if (ped_disk_type_check_feature (disk->type,
PED_DISK_TYPE_PARTITION_NAME))
vol_name = ped_partition_get_name (part);
@@ -2174,6 +2189,9 @@
{
struct blkpg_partition linux_part;
+ if (!_has_partitions (disk))
+ return 0;
+
memset (&linux_part, 0, sizeof (linux_part));
linux_part.pno = n;
return _blkpg_part_command (disk->dev, &linux_part,
@@ -2351,6 +2369,9 @@
char* dev_name = NULL;
char* params = NULL;
+ if (!_has_partitions(disk))
+ return 0;
+
dev_name = _device_get_part_path (disk->dev, part->num);
if (!dev_name)
return 0;
Reply to: