Bug 207772

Summary: [RHEL5 Beta2] device-mapper-multipath: partition maps aren't created.
Product: Red Hat Enterprise Linux 5 Reporter: Kiyoshi Ueda <kueda>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 5.0CC: agk, bmarzins, christophe.varoqui, coughlan, dwysocha, egoggin, harald, jnomura, junichi.nomura, kueda, kueda, lmb, mbroz, notting, pjones, tao, tranlan
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: 5.0.0 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-07 18:07:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Kiyoshi Ueda 2006-09-23 00:15:39 UTC
Description of problem:
Partition maps for a multipath device aren't automatically created
neither (1) at boot time nor (2) executing multipath command.


Version-Release number of selected component:
RHEL5-Server-20060921.0
  device-mapper-1.02.10-1.0.RHEL5
  device-mapper-multipath-0.4.7-5
  initscripts-8.41-1
  udev-095-8
  kernel-2.6.18-1.2685.el5


How reproducible:
Always


Steps to Reproduce:
 1. Create partitions on a multipath device.
 2. Reboot for (1) or Run multipath command for (2).


Actual results:
The multipath map for the device is created, but partition maps
for the device aren't created.
Example for (2) is below.
-------------------------------------------------------------------
[root@nec-tx7-1 ~]# dmsetup ls
No devices found
[root@nec-tx7-1 ~]# dmsetup ls --tree
No devices found
[root@nec-tx7-1 ~]# parted /dev/sda p

Disk /dev/sda: 71.6GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt

Number  Start   End     Size    File system  Name     Flags
 1      17.4kB  5000MB  5000MB               primary  lvm
 2      5000MB  10.0GB  5000MB               primary  lvm
 3      10.0GB  15.0GB  5000MB               primary  lvm
 4      15.0GB  20.0GB  5000MB               primary  lvm
 5      20.0GB  25.0GB  5000MB               primary  lvm
 6      25.0GB  30.0GB  5000MB               primary  lvm

Information: Don't forget to update /etc/fstab, if necessary.

[root@nec-tx7-1 ~]# multipath /dev/sda
create: disk0 (1NEC_iStorage_2000_000000092680024600000)  NEC,iStorage 2000
[size=67G][features=0][hwhandler=0]
\_ round-robin 0 [prio=2][undef]
 \_ 2:0:0:0  sda 8:0   [undef][ready]
 \_ 3:0:0:0  sdg 8:96  [undef][ready]
[root@nec-tx7-1 ~]#
[root@nec-tx7-1 ~]# dmsetup ls --tree
disk0 (253:0)
 |- (8:96)
 `- (8:0)
[root@nec-tx7-1 ~]#
-------------------------------------------------------------------


Expected results:
The multipath map and partition maps for the device are created
automatically.


Additional info:
/etc/rc.d/rc.sysinit has the following code which executes kpartx,
but partition maps aren't created during boot-up.
-------------------------------------------------------------------
if [ -c /dev/mapper/control ]; then
        if [ -f /etc/multipath.conf -a -x /sbin/multipath.static ] ; then
                modprobe dm-multipath > /dev/null 2>&1
                /sbin/multipath.static -v 0
                if [ -x /sbin/kpartx ]; then
                        /sbin/dmsetup ls --target multipath --exec "/sbin/kpartx
-a -p p"
                fi
        fi
-------------------------------------------------------------------

/etc/udev/rules.d/40-multipath.rules has the following rules which
looks like to execute kpartx, but partition maps aren't created
when execute multipath command.
-------------------------------------------------------------------
# multipath wants the devmaps presented as meaninglful device names
# so name them after their devmap name
SUBSYSTEM!="block", GOTO="end_mpath"
KERNEL!="dm-[0-9]*", ACTION=="add", PROGRAM=="/bin/bash -c '/sbin/lsmod |
/bin/grep ^dm_multipath'", RUN+="/sbin/multipath -v0 %M:%m"
KERNEL!="dm-[0-9]*", GOTO="end_mpath"
ACTION=="add", RUN+="/sbin/dmsetup ls --target multipath --exec '/sbin/kpartx
-a' -j %M -m %m"
PROGRAM=="/sbin/dmsetup ls --target multipath --exec /bin/basename -j %M -m %m",
RESULT=="?*", NAME="%k", SYMLINK="mpath/%c"
PROGRAM!="/bin/bash -c '/sbin/dmsetup info -c --noheadings -j %M -m %m |
/bin/grep -q .*:.*:.*:.*:.*:.*:.*:part[0-9]*-mpath-'", GOTO="end_mpath"
PROGRAM=="/sbin/dmsetup ls --target linear --exec /bin/basename -j %M -m %m",
NAME="%k", RESULT=="?*", SYMLINK="mpath/%c"
LABEL="end_mpath"
-------------------------------------------------------------------

Comment 1 Ben Marzinski 2006-10-06 02:45:00 UTC
I seems like the partition map issues step form two seperate problems
1. There is a generic dm udev rule that keeps udev from working on any dm device
2. Without that, udev works on the devices too quickly, so that they don't have
time to set up a table.

1 is easy to solve, add OPTIONS=last_rule to the udev lines that set the SYMLINK
and NAME for multipaths and kpartx partitions, this stops udev rule processing
before it gets to the blanket ignore_device rule for all dm devices.

2 is harder. The udev rules are happening so fast that not only are actually
interfering with the setup of the device in the kernel. Unfortunately, checking
in udev to see if the device is totally set up can make it impossible to ever
completely remove the device, due to a kernel bug.  It is possible to work
around this issue with a kernel patch, and I believe that Alasdair already
has a solution to this problem.

The fix for 1 is already checked into CVS. Hopefully, the fix for 2 will come
shortly.

Comment 2 Ben Marzinski 2006-10-06 17:18:49 UTC
There is a patch currently pending that should address issue number 2. There may
need to be some changes to the udev rules and to rc.sysinit to make use of this
and not execute before the devices are all the way set up.

Comment 4 Ben Marzinski 2006-12-14 23:41:07 UTC
Alasdair's fix is in the 2.6.18-1.2789.el5 kernel, so this bug should be totally
fixed now.

Comment 6 RHEL Program Management 2007-05-01 16:28:13 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 7 RHEL Program Management 2007-05-01 16:28:24 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 8 Kiersten (Kerri) Anderson 2007-05-07 18:07:25 UTC
Comments indicate that this one is fixed in GA version for RHEL5.0.  Marking it
closed.