summaryrefslogtreecommitdiffstats
path: root/lib/sysfs.c
diff options
context:
space:
mode:
authorPeter Rajnoha2012-09-20 09:39:57 +0200
committerKarel Zak2012-09-21 12:21:30 +0200
commit857db7f53c03ca363de50682a4958ae9f1f77391 (patch)
treed488ec54412bda11ff651382bfc9bcd0993c5818 /lib/sysfs.c
parentsetterm: make error message more informative (diff)
downloadkernel-qcow2-util-linux-857db7f53c03ca363de50682a4958ae9f1f77391.tar.gz
kernel-qcow2-util-linux-857db7f53c03ca363de50682a4958ae9f1f77391.tar.xz
kernel-qcow2-util-linux-857db7f53c03ca363de50682a4958ae9f1f77391.zip
lib/sysfs: fix sysfs_devname_to_devno for dm partitions
Partitions mapped by device-mapper are not like real partitions where there's a /sys/block/<parent>/<name>/dev sysfs path. We need to look at /sys/block/<name>/dev like we do for any other non-partition devices. The mapped partition is not found otherwise. For example, this bug shows up in lsblk while specifying a device on command line while that device is a dm mapping over a partition: $lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sda 8:0 0 128M 0 disk `-test (dm-0) 253:0 0 128M 0 dm `-test1 (dm-1) 253:1 0 127M 0 part Before this patch: $lsblk /dev/mapper/test1 lsblk: dm-1: unknown device name With this patch: $lsblk /dev/mapper/test1 NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT test1 (dm-1) 253:1 0 127M 0 part
Diffstat (limited to 'lib/sysfs.c')
-rw-r--r--lib/sysfs.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/sysfs.c b/lib/sysfs.c
index d1eccb585..1384acda6 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -58,7 +58,7 @@ dev_t sysfs_devname_to_devno(const char *name, const char *parent)
name += 5; /* unaccesible, or not node in /dev */
}
- if (!dev && parent) {
+ if (!dev && parent && strncmp("dm-", name, 3)) {
/*
* Create path to /sys/block/<parent>/<name>/dev
*/