Description of problem:
holders/slaves relationship between multipath device and the partitions on that device is a very bad reflection of reality.
Version-Release number of selected component (if applicable):
Name : device-mapper-multipath
Arch : x86_64
Version : 0.4.9
Release : 85.el7
Size : 178 k
Repo : installed
From repo : RHEL-7-RTT
Steps to Reproduce:
1. Multipath a bunch of device paths. Say paths are /dev/sda and /dev/sdb. mpath device is mpatha.
2. Create a partition on the device. This results in /dev/sda1 and /dev/sdb1 partitions, as well a a multipath partition, say mpatha1.
3. In sysfs, observe that mpatha1 is in holders of mpatha and that mpatha is a slave of mpatha1.
mpatha1 occurs in holders directory of mpatha, mpatha occurs in slaves directory of mpatha1.
Same as actual, but...
This seems like a bad representation of reality. Better to have mpatha1 be a subdirectory of mpatha's devicepath, just like sda1 is a subdirectory of sda's device path. A much more reasonable holder/slave relationship would be between mpatha1 and the partitions that it corresponds to, i.e., sda1 and sdb1.
This isn't an arbitrary decision. The current holder/slave relationship IS the reality here.
mpatha1 is not in reality a partition of mpatha. mpatha1 is a seperate device-mapper linear device that maps over the same part of mpatha as sda1 does over sda. Multipath does some additional fancy work to make mpatha1 seem more like a partition. For instance, if you try to remove mpatha through multipath, it will automatically first remove mpatha1. But multipath doesn't get to choose the holder/slave relationship. That depends on how devices are actually set up in the system. Any program that wants to work with these stacked devices correctly, would need to know how they are actually related. For instance, if some other program wanted to disassemble a stack of devices including a multipath device and it's kpartx partition device, it would need to remove the partition device first, before it could remove the multipath device, because the partition device mpatha1 really is a holder of mpatha.