]> git.ipfire.org Git - thirdparty/util-linux.git/commit
lib/sysfs: fix sysfs_devname_to_devno for dm partitions
authorPeter Rajnoha <prajnoha@redhat.com>
Thu, 20 Sep 2012 07:39:57 +0000 (09:39 +0200)
committerKarel Zak <kzak@redhat.com>
Fri, 21 Sep 2012 10:21:30 +0000 (12:21 +0200)
commit857db7f53c03ca363de50682a4958ae9f1f77391
treed488ec54412bda11ff651382bfc9bcd0993c5818
parent2754ffc5f52294a48ab73f4f26182020907997b0
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
lib/sysfs.c