Bug 1310320 - Add multipath option to disable kpartx partition creation
Add multipath option to disable kpartx partition creation
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: device-mapper-multipath (Show other bugs)
6.7
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Ben Marzinski
Lin Li
Milan Navratil
:
Depends On:
Blocks: 1324930 1311659 1386360 1388229
  Show dependency treegraph
 
Reported: 2016-02-20 05:24 EST by Lukas Herbolt
Modified: 2017-03-21 06:49 EDT (History)
11 users (show)

See Also:
Fixed In Version: device-mapper-multipath-0.4.9-94.el6
Doc Type: Release Note
Doc Text:
The "skip_kpartx" `multipath.conf` option to allow skipping `kpartx` partition creation has been added This update enables the user to only create a multipath device, and not any partitions, even if the device has a partition table. Now, multipath devices that are configured with the "skip_kpartx" option do not have any partition devices created for them.
Story Points: ---
Clone Of:
: 1311659 (view as bug list)
Environment:
Last Closed: 2017-03-21 06:49:20 EDT
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Lukas Herbolt 2016-02-20 05:24:00 EST
Description of problem:
As per man pages multipath has now new feature:
 - no_partitions:
       Disable automatic partitions generation via kpartx.

If you try to use this feature and recreate path it ends with error:
---
Feb 20 10:54:59 | libdevmapper: ioctl/libdm-iface.c(1795): dm info mpatha  NF   [16384] (*1)
Feb 20 10:54:59 | libdevmapper: libdm-common.c(763): Device uuid mangled [auto]: mpath-0QEMU    QEMU HARDDISK   virt005 --> mpath-0QEMU\x20\x20\x20\x20QEMU\x20HARDDISK\x20\x20\x20virt005
Feb 20 10:54:59 | libdevmapper: libdm-common.c(2196): Udev cookie 0xd4df1ac (semid 163842) incremented to 3
Feb 20 10:54:59 | libdevmapper: libdm-common.c(2446): Udev cookie 0xd4df1ac (semid 163842) assigned to CREATE task(0) with flags DISABLE_LIBRARY_FALLBACK         (0x20)
Feb 20 10:54:59 | libdevmapper: libdm-common.c(763): Device uuid mangled [auto]: mpath-0QEMU    QEMU HARDDISK   virt005 --> mpath-0QEMU\x20\x20\x20\x20QEMU\x20HARDDISK\x20\x20\x20virt005
Feb 20 10:54:59 | libdevmapper: ioctl/libdm-iface.c(1795): dm create mpatha mpath-0QEMU\x20\x20\x20\x20QEMU\x20HARDDISK\x20\x20\x20virt005 OF   [16384] (*1)
Feb 20 10:54:59 | libdevmapper: ioctl/libdm-iface.c(1795): dm reload mpatha  OF   [16384] (*1)
Feb 20 10:54:59 | libdevmapper: ioctl/libdm-iface.c(1813): device-mapper: reload ioctl on mpatha failed: Invalid argument
---

Breakpoint 1, _do_dm_ioctl (dmt=0x613ef0, command=3241737475, 
(gdb) 
buffer_repeat_count=<value optimized out>, retry_repeat_count=1, 
    retryable=0x7fffffffdeec) at ioctl/libdm-iface.c:1797
1797		if (ioctl(_control_fd, command, dmi) < 0 &&
(gdb) p ioctl(_control_fd, command, dmi)
$14 = -1
(gdb) p dmi
$15 = (struct dm_ioctl *) 0x613ff0
(gdb) p dmi->name 
$16 = "mpatha", '\000' <repeats 121 times>
(gdb) p dmi->uuid
$17 = "mpath-0QEMU\\x20\\x20\\x20\\x20QEMU\\x20HARDDISK\\x20\\x20\\x20virt005",
'\000' <repeats 66 times>
(gdb) p command
$18 = 3241737475
(gdb) p/x command
$19 = 0xc138fd03

If I understand correctly we are sending trough /dev/mapper/control ioctl which is not known to the DM.

Decoding the IOCTL: 0xc138fd03

11 0000010011100 011111101 00000011
^^ ^^^^^^^^^^^^^ ^^^^^^^^^ ^^^^^^^^
|  |             |         ` function # 0x3    
|  |             | 
|  |             ` ASCI char 0xFD
|  |
|  ` Size of args 0x9c 
|  
`Read/Write


Version-Release number of selected component (if applicable):
device-mapper-multipath-0.4.9-87.el6.x86_64

How reproducible:
Add:
---
features                "1 no_partitions"
---
into the device section in your multipath and run multipath -r 


Steps to Reproduce:
1. Configure mulitpath with:
   features                "1 no_partitions"
   in your device section 

2. Reload multipath via multipath -r 


Actual results:
Depends on verbosity, with default you will get 
multipath -r 
Feb 20 11:20:04 | mpatha: ignoring map
Feb 20 11:20:04 | mpatha: ignoring map

and path is not reloaded or created.

Along with it you will get following lines in var/log/messages
---
Feb 20 11:20:04 rhel6-debug kernel: [46304.409986] device-mapper: table: 253:2: multipath: Unrecognised multipath feature request
Feb 20 11:20:04 rhel6-debug kernel: [46304.410865] device-mapper: ioctl: error adding target to table
Feb 20 11:20:04 rhel6-debug kernel: [46304.414974] device-mapper: table: 253:2: multipath: Unrecognised multipath feature request
Feb 20 11:20:04 rhel6-debug kernel: [46304.415840] device-mapper: ioctl: error adding target to table
---
Expected results:
Path should be correctly created or reloaded with feature.


Additional info:
Feature works on RHEL 7.
Comment 2 Lukas Herbolt 2016-02-20 06:39:07 EST
ioctl ERR:
==========

11 00000100111000 11111101 00000011
^^ ^^^^^^^^^^^^^^ ^^^^^^^^ ^^^^^^^^
|  |              |         ` function # 0x3    
|  |              | 
|  |              ` ASCI char 0xFD
|  |
|  ` Size of args 0x138
|  
`Read/Write
Comment 3 Ben Marzinski 2016-02-22 14:31:53 EST
The no_partitions feature method of solving the problem of skipping kpartx running wasn't accepted upstream. The problem still needs to be solved, but it will most likely get solved with a multipath.conf parameter that sets a udev flag that skips kpartx running.  The effect will be the same.
Comment 4 Lukas Herbolt 2016-02-24 04:59:43 EST
Hi Ben,
Than you for info. Do you have the reject patch handy?
It's just my personal interest.

About the udev rules parameter, it's cool solution, do you any ETA?
Is there such a work already done in upstream?

Than you for the info.
Lukas
Comment 5 Ben Marzinski 2016-02-24 11:55:56 EST
I don't currently have a patch, and nothing exists upstream for this. The device mapper udev cookies code has reserved bits that targets can use to set flags for use in udev processing.  multipath already uses DM_SUBSYSTEM_UDEV_FLAG0 to avoid executing rules when the device has just been reloaded because it has added or
removed paths. It's not too much work to make sure we set DM_SUBSYSTEM_UDEV_FLAG1 (for instance) whenever we would do a dm action that would otherwise cause kpartx to get run, and then check for this in the udev rules.

As for when this will get done. It's too late for this to make it into RHEL-6.8, so it will probably land first in RHEL-7.3 and upstream, and then go into RHEL-6.9.
Comment 7 Ben Marzinski 2016-10-15 15:12:40 EDT
Fix ported from RHEL7. It's pretty significantly different under the covers, since there were a lot of changes in this code from RHEL6 to RHEL7, but it should work exactly the same.
Comment 10 Lin Li 2016-12-27 03:44:33 EST
Verified on device-mapper-multipath-0.4.9-99.el6
1. # man multipath.conf
defaults section
       skip_kpartx      If set to yes , kpartx will not automatically create partitions on the device. The default is no

multipaths section
       The following attributes are optional; if not set the default values are taken from the defaults or devices section:
              skip_kpartx

devices section
       The following attributes are optional; if not set the default values are taken from the defaults section:
              skip_kpartx

2. edit /etc/multipath.conf
defaults {

        find_multipaths yes
        user_friendly_names yes
        skip_kpartx yes
}

3. # multipath -r
reload: mpatha (360fff19abdd9552f8a36e5355226ba27) undef EQLOGIC,100E-00
size=50G features='0' hwhandler='0' wp=undef
|-+- policy='round-robin 0' prio=1 status=undef
| `- 1:0:0:0 sda 8:0  active ready running
`-+- policy='round-robin 0' prio=1 status=undef
  `- 2:0:0:0 sdb 8:16 active ready running

4. edit /etc/multipath.conf
defaults {

        find_multipaths yes
        user_friendly_names yes
        skip_kpartx yes
}

multipaths {
        multipath {
                uid 0
                gid 0
                wwid "360fff19abdd9552f8a36e5355226ba27"
                mode 0600
                skip_kpartx yes
        }
}

5. # multipath -r
reload: mpatha (360fff19abdd9552f8a36e5355226ba27) undef EQLOGIC,100E-00
size=50G features='0' hwhandler='0' wp=undef
|-+- policy='round-robin 0' prio=1 status=undef
| `- 1:0:0:0 sda 8:0  active ready running
`-+- policy='round-robin 0' prio=1 status=undef
  `- 2:0:0:0 sdb 8:16 active ready running
Comment 14 errata-xmlrpc 2017-03-21 06:49:20 EDT
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2017-0697.html

Note You need to log in before you can comment on or make changes to this bug.