Bug 1001096

Summary: multipath devices are not created properly when user_friendly_names enabled
Product: Red Hat Enterprise Linux 6 Reporter: Dominic Geevarghese <dgeevarg>
Component: device-mapper-multipathAssignee: Ben Marzinski <bmarzins>
Status: CLOSED NOTABUG QA Contact: Red Hat Kernel QE team <kernel-qe>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.4CC: acathrow, agk, bmarzins, dwysocha, heinzm, msnitzer, prajnoha, prockai, zkabelac
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-08-30 18:10:21 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:
Embargoed:

Description Dominic Geevarghese 2013-08-26 13:42:51 UTC
Description of problem:

When user_friendly_names are set in multipath.conf , devicenames are not properly created under /dev/mapper/* . However, everything seems working when user_friendly_names unset in config.

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

kernel-2.6.32-358.14.1.el6.x86_64
device-mapper-multipath-0.4.9-64.el6_4.1.x86_64
kpartx-0.4.9-64.el6_4.1.x86_64
device-mapper-1.02.77-9.el6.x86_64

How reproducible:

I could reproduce always in KVM based VM.

Steps to Reproduce:

1. Create partition on iSCSI disk ( used fdisk )

2. kpartx to create map under /dev/mapper/

# ls -l /dev/mapper/*
crw-rw----. 1 root root 10, 58 Aug 27 00:14 /dev/mapper/control
lrwxrwxrwx. 1 root root      7 Aug 27 00:15 /dev/mapper/mpatha -> ../dm-0

# kpartx -a -v /dev/mapper/mpatha 
add map mpatha1 (253:1): 0 1029138 linear /dev/mapper/mpatha 62

# ls -l /dev/mapper/*
crw-rw----. 1 root root 10, 58 Aug 27 00:14 /dev/mapper/control
lrwxrwxrwx. 1 root root      7 Aug 27 00:15 /dev/mapper/mpatha -> ../dm-0
lrwxrwxrwx. 1 root root      7 Aug 27 00:17 /dev/mapper/mpatha1 -> ../dm-1

3. Created one more partition. Still kpartx is creating device _without_  (p)artition notation.

# kpartx -a -v /dev/mapper/mpatha 
add map mpatha1 (253:1): 0 1029138 linear /dev/mapper/mpatha 62
add map mpatha2 (253:2): 0 1029200 linear /dev/mapper/mpatha 1029200

# ls -l /dev/mapper/*
crw-rw----. 1 root root 10, 58 Aug 27 00:14 /dev/mapper/control
lrwxrwxrwx. 1 root root      7 Aug 27 00:15 /dev/mapper/mpatha -> ../dm-0
lrwxrwxrwx. 1 root root      7 Aug 27 00:18 /dev/mapper/mpatha1 -> ../dm-1
lrwxrwxrwx. 1 root root      7 Aug 27 00:18 /dev/mapper/mpatha2 -> ../dm-2

4. Flushed the maps , recreated it by `multipath -v2` . New maps got (p)artition notation at the end of device.

# ls -l /dev/mapper/*
crw-rw----. 1 root root 10, 58 Aug 27 00:14 /dev/mapper/control
lrwxrwxrwx. 1 root root      7 Aug 27 00:18 /dev/mapper/mpatha -> ../dm-0
lrwxrwxrwx. 1 root root      7 Aug 27 00:18 /dev/mapper/mpathap1 -> ../dm-1
lrwxrwxrwx. 1 root root      7 Aug 27 00:18 /dev/mapper/mpathap2 -> ../dm-2

5. kpartx on third partition failed by following

# kpartx -a -v /dev/mapper/mpatha 
device-mapper: create ioctl on mpatha1 failed: Device or resource busy
create/reload failed on mpatha1
add map mpatha1 (0:0): 0 1029138 linear /dev/mapper/mpatha 62
device-mapper: create ioctl on mpatha2 failed: Device or resource busy
create/reload failed on mpatha2
add map mpatha2 (0:0): 0 1029200 linear /dev/mapper/mpatha 1029200
add map mpatha3 (253:3): 0 1029200 linear /dev/mapper/mpatha 2058400

6. What happened to the maps ? . Third device is created _without_ (p)artition notation at end.

# ls -l /dev/mapper/*
crw-rw----. 1 root root 10, 58 Aug 27 00:14 /dev/mapper/control
lrwxrwxrwx. 1 root root      7 Aug 27 00:18 /dev/mapper/mpatha -> ../dm-0
lrwxrwxrwx. 1 root root      7 Aug 27 00:19 /dev/mapper/mpatha3 -> ../dm-3
lrwxrwxrwx. 1 root root      7 Aug 27 00:18 /dev/mapper/mpathap1 -> ../dm-1
lrwxrwxrwx. 1 root root      7 Aug 27 00:18 /dev/mapper/mpathap2 -> ../dm-2

7. Set `user_friendly_names no` in config. I could see device created properly .


# ls -l /dev/mapper/*

lrwxrwxrwx. 1 root root   7 Aug 27 00:34 /dev/mapper/1IET\x20\x20\x20\x20\x2000010001 -> ../dm-0
crw-rw----. 1 root root 10, 58 Aug 27 00:14 /dev/mapper/control

# kpartx -a -v /dev/mapper/1IET\\x20\\x20\\x20\\x20\\x2000010001 

add map 1IET     00010001p1 (253:1): 0 1029138 linear /dev/mapper/1IET\x20\x20\x20\x20\x2000010001 62

# ls -l /dev/mapper/*

lrwxrwxrwx. 1 root root      7 Aug 27 00:34 /dev/mapper/1IET\x20\x20\x20\x20\x2000010001 -> ../dm-0
lrwxrwxrwx. 1 root root      7 Aug 27 00:35 /dev/mapper/1IET\x20\x20\x20\x20\x2000010001p1 -> ../dm-1
crw-rw----. 1 root root 10, 58 Aug 27 00:14 /dev/mapper/control


Actual results:

kpartx failed to create device name properly without multipath daemon reload or flush maps, recreate by multipath.

Expected results:

kpartx should create correct devices under /dev/mapper/ at first place.


Thanks,

Comment 2 Ben Marzinski 2013-08-30 18:10:21 UTC
By default kpartx doesn't add a 'p' unless the device name ends in a number.  In RHEL6, when multipath creates a device, kpartx is automatically run on the resulting device by udev, using the rules in /lib/udev/rules.d/40-multipath.rules with the following command:

RUN+="$env{MPATH_SBIN_PATH}/kpartx -a -p p $tempnode"

The "-p p" Forces the 'p' delimiter, regardless of whether or not the device ends in a number.  If you add that to you kpartx call, things will work the same as they do when the partition devices are automatically created by udev.