[parted-devel] [PATCH 1/2] libparted: don't canonicalize /dev/md/ paths

Phillip Susi psusi at ubuntu.com
Thu Jan 10 19:26:56 UTC 2013


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 1/10/2013 12:04 PM, Brian C. Lane wrote:

> The specific problem in this case is that a user of libparted
> (anaconda via pyparted) calls libparted using the /dev/md/foo name
> and parted follows the symlink. Later attempts to use the
> /dev/md/foo name fail because libparted didn't keep track of the
> name that it was handed by pyparted.
> 
> I don't think there is any need to ask the kernel about it. I'm not
> even sure if it knows about the reverse relationship. In some cases
> this is handled by mdadm, others by device-mapper.

Yes, dm had the same problem and it looks like you are fixing it in
the same way.  I think the fix for both is incomplete though.

In arch/linux.c we query the kernel for the name and canonicalize the
device name to /dev/mapper, but the name is only used internally.
This is why we get the 'p' correct for dm.  We don't do this for md
though, so simply killing the canonicalization lets things work
correctly when you run parted on /dev/md/foo, but not if you run it on
any of the other names, including /dev/md0, or /dev/disk/by-id/.  To
make those work correctly we would have to at least canonicalize the
name *correctly* in linux.c the way we now do with dm.

Further, I don't see why we only use the canonical name internally.
We should be doing the correct canonicalization in ped_get_device.
That way when you run parted on /dev/dm-0 or /dev/md0 or
/dev/disk/by-id, it would report the correct /dev/md/ or /dev/mapper/
name in its output, the way it does for other disks.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iQEcBAEBAgAGBQJQ7xYAAAoJEJrBOlT6nu75+5gH/iUXlHHlmdOXkn7pLnO+2UEQ
8rvx4FbZBMi02ML8kQytI7L1nh1H6MicycNZXUz05eaSSwFewaHFQImuGMC4GKqz
fQGLUZB74TJoBtcD9KIPIJBWRWgFPqqk6TTJdJTsW+Ex0/m2No5xRVy2frra9o/v
yNd46glWFBW711CqMkOmwDWGD1qFlmA9qJGZ/bf+3+R1R7H0AEdosOl4s91lyYlg
I46QtxYI3R9OiMQlzmEvzQ5Ici1F9kvXavBfP/BH0yVlgiOtaCT3dcenh0R/F4G5
jw47yfivqbNV8H2n8Axgm/sPkT3E4f7vUmvyW8cGBNNAeCHaxGF/hInBymAepNw=
=WkfV
-----END PGP SIGNATURE-----



More information about the parted-devel mailing list