Package: libblkid1 Version: 1.41.3-1 The current version of e2fsprogs/libblkid1 will show dm-multipath devices as /dev/dm-X devices, instead of /dev/mapper/mpathX. This is a cosmetic bug. However because the prioritization code in libblkid1 works on device names, this leads to a lack of device prioritization.
The device prioritization is important when working with dm-multipath and volume labels. If a dm/mpath device doesn't get prioritized, 'mount -L' tends to mount members devices like /dev/sda instead of /dev/dm-X or /dev/mapper/mpathX. I've attached a patch, which correctly makes blkid return the /dev/mapper/mpathX device instead of /dev/dm-X. This change automatically fixes the prioritization code, because now the devices names match. This patch, is basically a rebased version of the following: http://git.kernel.org/?p=fs/ext2/e2fsprogs.git;a=commit;h=4271e23942bdc60e1fa6c0b26bc666a94a8b3e1d and http://thread.gmane.org/gmane.comp.file-systems.ext4/12896 -- Regards, Pascal de Bruijn <pas...@unilogicnetworks.net> Junior Network Engineer - Unilogic Networks B.V. Unilogic Networks B.V. Bergerweg 120 6135 KD Sittard T: 046-4571640 F: 046-4571641 E: i...@unilogicnetworks.net
diff -Nurpd e2fsprogs-1.41.3-orig/lib/blkid/devname.c e2fsprogs-1.41.3-mpath/lib/blkid/devname.c --- e2fsprogs-1.41.3-orig/lib/blkid/devname.c 2008-10-07 16:22:39.000000000 +0200 +++ e2fsprogs-1.41.3-mpath/lib/blkid/devname.c 2009-05-15 08:55:28.000000000 +0200 @@ -177,6 +177,15 @@ static void probe_one(blkid_cache cache, if (dev && dev->bid_devno == devno) goto set_pri; + /* Try to translate private device-mapper dm-<N> names + * to standard /dev/mapper/<name>. + */ + if (!strncmp(ptname, "dm-", 3) && isdigit(ptname[3])) { + blkid__scan_dir("/dev/mapper", devno, 0, &devname); + if (devname) + goto get_dev; + } + /* * Take a quick look at /dev/ptname for the device number. We check * all of the likely device directories. If we don't find it, or if @@ -195,7 +204,7 @@ static void probe_one(blkid_cache cache, if (stat(device, &st) == 0 && S_ISBLK(st.st_mode) && st.st_rdev == devno) { devname = blkid_strdup(device); - break; + goto get_dev; } } /* Do a short-cut scan of /dev/mapper first */ @@ -206,6 +215,8 @@ static void probe_one(blkid_cache cache, if (!devname) return; } + +get_dev: dev = blkid_get_dev(cache, devname, BLKID_DEV_NORMAL); free(devname);