Bug 510256 - PATCH: Add blkext and mdp to default filter list
PATCH: Add blkext and mdp to default filter list
Product: Fedora
Classification: Fedora
Component: lvm2 (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Mike Snitzer
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-07-08 10:03 EDT by Hans de Goede
Modified: 2009-07-22 15:46 EDT (History)
12 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-07-22 15:46:47 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
PATCH: Add blkext and mdp to default filter list (755 bytes, patch)
2009-07-08 10:03 EDT, Hans de Goede
no flags Details | Diff

  None (edit)
Description Hans de Goede 2009-07-08 10:03:06 EDT
Created attachment 350940 [details]
PATCH: Add blkext and mdp to default filter list

lvm currently refuses to use partitionable md raid devices as PV's, the attached patch fixes this.

We need this for biosraid using mdraid for isw / imsm biosraid.
Comment 1 Mike Snitzer 2009-07-08 11:37:08 EDT
ACK, patch looks good.

NOTE: I found this on the crash-utility mailing list when googling for what blkext is:

The blkext is supposed to get used as soon as someone wants to put more
than 15 partitions on an sd disk. (Explanation at

The linux-2.6 git commit that introduced extended device numbers is:
Comment 2 Mike Snitzer 2009-07-08 11:50:53 EDT
Unfortunately, supporting blkext opens a can of worms in other areas of LVM2 that we'll need to consider as part of the LVM2 topology support that is pending for inclusion in the current LVM2.

Specifically, LVM2's topology support needs to determine a partition's parent device.  To do so I currently use something like:

dev_t parent_dev = partition_dev - (minor(partition_dev) % max_partitions(major(partition_dev)));

Anyway, this linux-2.6 commit offers a hint of how to resolve this but I need to dig deeper:

commit 0fc71e3d6520ba7abad5cfbc9a33db0190e4d5b8
Author: Tejun Heo <tj@kernel.org>
Date:   Mon Oct 13 13:27:59 2008 +0200

    block: add partition attribute for partition number

    With extended devt, finding out the partition number becomes a bit
    more challenging as subtracting the minor number from that of the
    parent device doesn't work anymore.  The only thing left is parsing
    the partition name which is brittle and not exactly universal (some
    have '-' between the device name and partition number while others
    don't).  This patch introduced partition attribute which contains the
    partition number of the device.  This should make finding partitions
    and its index easier.

    This problem and solution were suggested by H. Peter Anvin.
Comment 3 Mike Snitzer 2009-07-09 10:45:57 EDT
It is clear that LVM2 must support blkext moving forward.  The inability to easily know the associated parent device for a given partition (through sysfs) is a separate issue that needs to be addressed upstream.

It appears that in the future MD may transition to using blkext entirely for partitioned MD devices; this is from Neil Brown's pull request associated with the md change to allow use of blkext:

The third [patch, commit ref below] causes md to use the new extended partitioning scheme (thanks Tejun) so that regular md devices (e.g. /dev/mdX - major number 9) can have partitions.  This means we could eventually deprecate the 'mdp' alternate major number that allows partitions md devices.

The following linux-2.6 commit enabled MD to use blkext:
Comment 4 Dan Williams 2009-07-09 12:04:06 EDT
The parent device can be discovered by using /sys/dev/block to resolve the sysfs path by major:minor and then looking at the parent directory:

# ls -l /dev/md125p1 
brw-rw---- 1 root disk 259, 0 Jul  7 00:46 /dev/md125p1

# readlink /sys/dev/block/259\:0
Comment 5 Mike Snitzer 2009-07-09 12:54:37 EDT
In response to comment #5, good point.  The same would apply to normal partitions too.  I'd still prefer if sysfs had something like a 'parent' attribute for partitions but short of that this seems workable (albeit somewhat clumsy).
Comment 6 Mike Snitzer 2009-07-09 15:05:03 EDT

I don't think that new kernels (Linux >= 2.6.28) use mdp at all.

In fact I just verified this on 2.6.31-rc2 by creating a 3 disk raid5
and then using fdisk to partition /dev/md0.

/dev/md0p1 was created using blkext (major=259):
brw-r----- 1 root disk 259, 0 Jul  9 14:01 /dev/md0p1

The reason for this is the same that I detailed in comment #3.

Any chance you could verify that mdp is no longer used at all as part of
your efforts on this F12 feature?

I'll add both blkext and mdp support to LVM2 but I think it'd be nice if we
confirmed how things are _really_ working.

Comment 7 Hans de Goede 2009-07-10 03:15:11 EDT

(In reply to comment #6)
> Hans,
> I don't think that new kernels (Linux >= 2.6.28) use mdp at all.

I think you're right, during my testing I'vve only seen blkext's major being used for md partitions, I added mdp to the patch as it seemed sensible to
allow that too, but I've not seen it being used in the wild (with rawhide, so kernel 2.6.31rc#).


Comment 8 Mike Snitzer 2009-07-10 09:43:08 EDT
This issue has been fixed upstream.  It will get pulled in to rawhide when the next LVM2 release is made.
Comment 9 Hans de Goede 2009-07-10 10:45:55 EDT
(In reply to comment #8)
> This issue has been fixed upstream.  It will get pulled in to rawhide when the
> next LVM2 release is made.  


Is this next LVM2 release going to happen soon ? I would really like to see this
fixed soon, so that people can start testing isw raid using mdraid in rawhide

If this is not happening soon, can you please add the patch to the package ? I can do this if you want me too (if granted the necessary rights in pkgdb).
Comment 10 Alasdair Kergon 2009-07-10 13:13:01 EDT
There'll be another release next week - there's plenty more stuff needs testing and it's a waste of time to single out individual changes.
Comment 11 Mike Snitzer 2009-07-22 15:16:26 EDT
Fedora's lvm2/devel has been updated to LVM2 2.02.49 (which includes this filter fix).

Note You need to log in before you can comment on or make changes to this bug.