Bug 510256

Summary: PATCH: Add blkext and mdp to default filter list
Product: [Fedora] Fedora Reporter: Hans de Goede <hdegoede>
Component: lvm2Assignee: Mike Snitzer <msnitzer>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: agk, bmarzins, bmr, chellwig, dan.j.williams, dwysocha, heinzm, lvm-team, mbroz, msnitzer, prajnoha, prockai
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-07-22 19:46:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
PATCH: Add blkext and mdp to default filter list none

Description Hans de Goede 2009-07-08 14:03:06 UTC
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 15:37:08 UTC
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
http://thread.gmane.org/gmane.linux.kernel/701825)

The linux-2.6 git commit that introduced extended device numbers is:
3e1a7ff8a0a7b948f2684930166954f9e8e776fe

Comment 2 Mike Snitzer 2009-07-08 15:50:53 UTC
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>
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 14:45:57 UTC
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:
92850bbd71228730c80efd491e7427650188d359

Comment 4 Dan Williams 2009-07-09 16:04:06 UTC
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
../../devices/virtual/block/md125/md125p1

Comment 5 Mike Snitzer 2009-07-09 16:54:37 UTC
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 19:05:03 UTC
Hans,

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.

Thanks,
Mike

Comment 7 Hans de Goede 2009-07-10 07:15:11 UTC
Hi,

(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#).

Regards,

Hans

Comment 8 Mike Snitzer 2009-07-10 13:43:08 UTC
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 14:45:55 UTC
(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.  

Thanks!

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
soon.

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 17:13:01 UTC
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 19:16:26 UTC
Fedora's lvm2/devel has been updated to LVM2 2.02.49 (which includes this filter fix).