Bug 1323806

Summary: kpartx creates linear devices corresponding to partitions which have no device file
Product: Red Hat Enterprise Linux 7 Reporter: mulhern <amulhern>
Component: device-mapper-multipathAssignee: LVM and device-mapper development team <lvm-team>
Status: CLOSED NOTABUG QA Contact: Lin Li <lilin>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: agk, bmarzins, heinzm, lilin, msnitzer, prajnoha
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-04-08 02:56:18 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description mulhern 2016-04-04 18:39:05 UTC
Description of problem:

The initial situation is weird. There are partitions on certain drives, but, for some reason, corresponding partition devices are not created. However, on reboot, kpartx creates multipath devices corresponding to those partitions. So, the multipath devices exist, but none of the underlying devices that multipath must depend on.

Version-Release number of selected component (if applicable):

Installed Packages
Name        : kpartx
Arch        : x86_64
Version     : 0.4.9
Release     : 85.el7
Size        : 37 k
Repo        : installed
From repo   : RHEL-7.2

How reproducible:

Seems consistent.

Steps to Reproduce:
1. First, get a situation where partitions are not being given their devices.
2. Make sure that these partitions are on multipathed devices.
3. Do a reboot and notice that the partitions do have their corresponding multipath devices even though there are no partition devices.

Actual results:

Multipath devices for partitions exist even though the device corresponding to the path on each partition does not exist.

Expected results:

I think multipath needs to be more cautious. I do not know much about the internals of multipath, but I feel like it must make use of the device nodes and so forth of the paths that correspond to the partitions.

Additional info:

None.

Comment 1 mulhern 2016-04-04 18:47:58 UTC
For example (output of multipath -ll):

WDC_WD10EFRX-68PJCN0_WD-WCC4JLHVDELY dm-11 ATA     ,WDC WD10EFRX-68P
size=932G features='0' hwhandler='0' wp=rw
`-+- policy='service-time 0' prio=1 status=active
  |- 0:0:37:0 sdap 66:144 active ready running
  `- 0:0:42:0 sdat 66:208 active ready running

sdap and sdat are multipathed paths to some device, have corresponding device nodes, and so forth.

dm-11 has a holder dm device:

ls /sys/devices/virtual/block/dm-11/holders/
dm-26

which corresponds to the partition on the drive that both sdap and sdat refer to.

But neither sdap nor sdat have partition devices:

[root@megadeth mulhern-journal]# ls /sys/devices/virtual/block/dm-11/slaves/sdat
alignment_offset  discard_alignment  holders   removable  subsystem
bdi               events             inflight  ro         trace
capability        events_async       power     size       uevent
dev               events_poll_msecs  queue     slaves
device            ext_range          range     stat
[root@megadeth mulhern-journal]# ls /sys/devices/virtual/block/dm-11/slaves/sdap
alignment_offset  discard_alignment  holders   removable  subsystem
bdi               events             inflight  ro         trace
capability        events_async       power     size       uevent
dev               events_poll_msecs  queue     slaves
device            ext_range          range     stat

even though the partition is definitely on the drive:

[root@megadeth mulhern-journal]# parted /dev/dm-11
GNU Parted 3.1
Using /dev/dm-11
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free                                                       
Model: Linux device-mapper (multipath) (dm)
Disk /dev/dm-11: 1000GB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
        17.4kB  1049kB  1031kB  Free Space
 1      1049kB  999MB   998MB
        999MB   1000GB  999GB   Free Space

Comment 3 Ben Marzinski 2016-04-05 17:59:51 UTC
The multipath udev rules intentionally remove the partition device nodes from the path devices.

From /lib/udev/rules.d/62-multipath.rules:

ENV{DM_MULTIPATH_DEVICE_PATH}=="1", ENV{DM_MULTIPATH_WIPE_PARTS}="1", \
        RUN+="/sbin/partx -d --nr 1-1024 $env{DEVNAME}"


ENV{DM_MULTIPATH_WIPE_PARTS} is used to make sure that these rules only wipe the partitions once.  If a user recreates the partition devices (for instance, by using "blockdev --rereadpt") they will not get removed a second time, until you reboot.

So, if I'm understanding this bugzilla correctly, this can be closed as NOTABUG, correct?

Comment 4 mulhern 2016-04-05 19:31:39 UTC
Yes, please go ahead.