Package: parted
Version: 2.3-10
Severity: serious
Tags: patch wheezy sid

Background: I have added support to the debian installer for installation on Intel Matrix Raid (imsm) arrays as supported by mdadm (I'll be submitting patches to debian-boot soon).

When installing on such an array, partitions are created directly on the array (e.g. /dev/md0). Before kernel 2.6.28, partitionable md arrays were seperate from 'normal' md arrays (different dev_t's), but since 2.6.28 that has been consolidated.

At the same time a new sysfs key that indicates the max number of partitions has been introduced- the old key is called "range" and for md devices is always set to "1". The new key is called "ext_range" and contains the correct value. libparted should use the new key, otherwise it cannot partition md devices.

Upstream has already changed to use the "ext_range" key instead of "range":


http://anonscm.debian.org/gitweb/?p=parted/parted.git;a=commitdiff;h=ca97da905bd21f2a4371f4717f7c46a936af6b2c

commit ca97da905bd21f2a4371f4717f7c46a936af6b2c
Author: Petr Uzel <petr.u...@suse.cz>
Date:   Sat Nov 26 15:45:08 2011 +0100

    libparted: use ext_range to find out largest possible partition

    Parted uses /sys/block/DEV/range file to find out how many partitions
    can the blockdevice hold and uses this number in its algorithm
    for informing the kernel about modified partitions. This works
    fine for most devices, however, it fails on partitionable MD arrays,
    because these have 1 in range file. Using ext_range should be safer
    and work for all devices.

    * libparted/arch/linux.c (_device_get_partition_range): Use
    /sys/block/DEV/ext_range instead of range sysfs file
    * NEWS: Mention the change.

    Addresses: http://bugzilla.novell.com/567652

Attached is a backport of the patch to the version in wheezy/unstable.

Please consider this patch for wheezy.

Suggested changelog entry:

  * backport md-partitions.patch: libparted/arch/linux.c
    (_device_get_partition_range): Use /sys/block/DEV/ext_range instead
    of range sysfs file
    
http://anonscm.debian.org/gitweb/?p=parted/parted.git;a=commitdiff;h=ca97da905bd21f2a4371f4717f7c46a936af6b2c

commit ca97da905bd21f2a4371f4717f7c46a936af6b2c
Author: Petr Uzel <petr.u...@suse.cz>
Date:   Sat Nov 26 15:45:08 2011 +0100

    libparted: use ext_range to find out largest possible partition

    Parted uses /sys/block/DEV/range file to find out how many partitions
    can the blockdevice hold and uses this number in its algorithm
    for informing the kernel about modified partitions. This works
    fine for most devices, however, it fails on partitionable MD arrays,
    because these have 1 in range file. Using ext_range should be safer
    and work for all devices.

    * libparted/arch/linux.c (_device_get_partition_range): Use
    /sys/block/DEV/ext_range instead of range sysfs file

    Addresses: http://bugzilla.novell.com/567652

diff -u a/libparted/arch/linux.c b/libparted/arch/linux.c
--- a/libparted/arch/linux.c    2012-08-24 12:06:18.000000000 +0000
+++ b/libparted/arch/linux.c    2012-08-24 12:10:31.176877539 +0000
@@ -2403,7 +2403,7 @@
 
 /*
  * 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
@@ -2414,7 +2414,7 @@
         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;

Reply via email to