]> 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>
Mon, 1 Oct 2012 09:58:06 +0000 (11:58 +0200)
commit01e6f6c523d7ec25e9545da5cdb22c1794378c3f
tree5c0a3140b85373c77c0c524fd1b7f8b0f4ea9890
parent504c01228f1c07a9949203a140de54af8b13c912
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