Bug 675366

Summary: kernel: device-mapper: table: 253:<present max MinorNumber in /proc/partitions + 1 > : multipath: error getting device
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.0CC: agk, bmarzins, dwysocha, heinzm, mbroz, 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: 2011-02-10 15:44:35 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 Dominic Geevarghese 2011-02-05 07:38:45 UTC
Description of problem:

Kernel reported the following messages while starting multipathd service even no 253:3 device present in /proc/partitions.

kernel: device-mapper: table: 253:3: multipath: error getting device
kernel: device-mapper: ioctl: error adding target to table

Device major:minor always equal to the 253:<present max minor number in /proc/partitions + 1 > 

How reproducible:

Always. Packages version that I have used 

device-mapper-1.02.53-8.el6_0.4.i686
kernel-2.6.32-71.el6.i686
device-mapper-multipath-0.4.9-31.el6_0.1.i686

Steps to Reproduce:

1) # grep -v ^# /etc/multipath.conf 

defaults {
	user_friendly_names yes
}

2) # /etc/init.d/multipathd start
Starting multipathd daemon:                                [  OK  ]

3) # tailf /vat/log/messgaes 

kernel: device-mapper: table: 253:3: multipath: error getting device
kernel: device-mapper: ioctl: error adding target to table
kernel: device-mapper: table: 253:3: multipath: error getting device
kernel: device-mapper: ioctl: error adding target to table
multipathd: mpathb: load table [0 10444800 multipath 0 0 2 1 round-robin 0 1 1 8:16 1000 round-robin 0 1 1 8:32 1000]
multipathd: mpathb: event checker started
multipathd: path checkers start up
multipathd: dm-2: add map (uevent)
multipathd: dm-2: devmap already registered

4) # cat /proc/partitions 
major minor  #blocks  name

   8        0    5632000 sda
   8        1     512000 sda1
   8        2    5118976 sda2
 253        0    4067328 dm-0
 253        1    1048576 dm-1
   8       16    5222400 sdb
   8       32    5222400 sdc
 253        2    5222400 dm-2

5) # dmsetup info -C
Name                 Maj Min Stat Open Targ Event  UUID                                                                
mpathb               253   2 L--w    0    1      0 mpath-1IET     00010001                                             
vg_dhcp20934-lv_swap 253   1 L--w    1    1      0 LVM-OrmGij55wXoBWYPEdHS26IMbg8RzNpyh5I87nqZ0O2HO9hsDRq5evPvgejTC0nqJ
vg_dhcp20934-lv_root 253   0 L--w    1    1      0 LVM-OrmGij55wXoBWYPEdHS26IMbg8RzNpyh3e67YETLuX2ATP7pQF305zMCL5QkmZfn

Actual results:

Kernel reports that 

kernel: device-mapper: table: 253:3: multipath: error getting device
kernel: device-mapper: ioctl: error adding target to table

Expected results:

Kernel should not report error message for device which is not present. 

Additional info:

Workaround is to blacklist the local disk in multipath.conf 

Here is the local disk info 

# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg_dhcp20934-lv_root
                      3.9G  2.2G  1.5G  61% /
tmpfs                 250M   19M  231M   8% /dev/shm
/dev/sda1             485M   46M  414M  10% /boot

# pvs
  PV         VG           Fmt  Attr PSize PFree
  /dev/sda2  vg_dhcp20934 lvm2 a-   4.88g    0 

# grep -v ^# /etc/multipath.conf 


defaults {
	user_friendly_names yes
}
blacklist {
	devnode "^sda$"
}

# /etc/init.d/multipathd start
Starting multipathd daemon:                                [  OK  ]

/var/log/messages 

multipathd: mpathb: load table [0 10444800 multipath 0 0 2 1 round-robin 0 1 1 8:16 1000 round-robin 0 1 1 8:32 1000]
multipathd: mpathb: event checker started
multipathd: path checkers start up
multipathd: dm-2: add map (uevent)
multipathd: dm-2: devmap already registered

- dominic

Comment 2 Mike Snitzer 2011-02-10 02:22:31 UTC
(In reply to comment #0)
> Description of problem:
> 
> Kernel reported the following messages while starting multipathd service even
> no 253:3 device present in /proc/partitions.
> 
> kernel: device-mapper: table: 253:3: multipath: error getting device
> kernel: device-mapper: ioctl: error adding target to table
> 
> Device major:minor always equal to the 253:<present max minor number in
> /proc/partitions + 1 > 

You're not reading the error properly (admittedly not the easiest to parse).  The DM device that is being created (253:3) is failing to get a device during table load -- as such the DM device is never created (that is why you never see 253:3 in /proc/partitions).

Though the error could be improved by sharing which device DM couldn't get,
e.g.:
 multipath: error getting device $NAME 
  or
 multipath: error getting device $MAJ:$MIN

> Additional info:
> 
> Workaround is to blacklist the local disk in multipath.conf 
> 
> Here is the local disk info 
> 
> # df -h
> Filesystem            Size  Used Avail Use% Mounted on
> /dev/mapper/vg_dhcp20934-lv_root
>                       3.9G  2.2G  1.5G  61% /
> tmpfs                 250M   19M  231M   8% /dev/shm
> /dev/sda1             485M   46M  414M  10% /boot
> 
> # pvs
>   PV         VG           Fmt  Attr PSize PFree
>   /dev/sda2  vg_dhcp20934 lvm2 a-   4.88g    0 
> 
> # grep -v ^# /etc/multipath.conf 
> 
> 
> defaults {
>  user_friendly_names yes
> }
> blacklist {
>  devnode "^sda$"
> }
> 
> # /etc/init.d/multipathd start
> Starting multipathd daemon:                                [  OK  ]
> 
> /var/log/messages 
> 
> multipathd: mpathb: load table [0 10444800 multipath 0 0 2 1 round-robin 0 1 1
> 8:16 1000 round-robin 0 1 1 8:32 1000]
> multipathd: mpathb: event checker started
> multipathd: path checkers start up
> multipathd: dm-2: add map (uevent)
> multipathd: dm-2: devmap already registered

AFAIK if a device is already open multipathd shouldn't attempt to add it to an mpath device.  So we need some clarification from Ben on this.

Comment 3 Ben Marzinski 2011-02-10 15:44:35 UTC
> multipathd: dm-2: add map (uevent)
> multipathd: dm-2: devmap already registered

These messages can be safely ignored.  They will be going away in 6.1.  Multipathd attempts to add new devices on change uevents.  Unfortunately, these change uevents can happen with stunning frequency, for things as mundane as doing IO to the device.  In 6.1 multipath doesn't print out any messages at the default verbosity when it gets extraneous change uevents.


These messages:

kernel: device-mapper: table: 253:3: multipath: error getting device
kernel: device-mapper: ioctl: error adding target to table
kernel: device-mapper: table: 253:3: multipath: error getting device
kernel: device-mapper: ioctl: error adding target to table

Are most likely due to multipathd attempting to create a multipath device on top of an already opened device.  This is usually because there are device that should be blacklisted which are not.

Running:

# multipath -v3

Will show you all of the device that multipath is trying to create (along with a lot of other debugging information). You can use this to see which device is not getting created.

You should see a line like:

Feb 10 03:45:21 | mpatha: set ACT_CREATE (map does not exist)
Feb 10 03:45:21 | mpatha: domap (0) failure for create/reload map

This tells you that mpatha failed to get created. Then you can look for lines like:

Feb 10 03:45:21 | sda: ownership set to mpatha

This tells you which devices belong to mpatha (in this case it is sda, which is actually my root device, and should not be multipathd)

Then you can look for a line like

Feb 10 03:45:21 | sda: uid = 1ATA     WDC WD800JD-75MSA3                        
   WD-WMAM9HH14567 (callout)

This tells you that the wwid of sda is
1ATA     WDC WD800JD-75MSA3                           WD-WMAM9HH14567

so you should add

wwid "1ATA     WDC WD800JD-75MSA3                           WD-WMAM9HH14567"

to the blacklists section of /etc/multipath.conf
For blacklisting individual devices, its always best to use the wwid, since it
is guaranteed to always be the same, while the devnode can change on reboot.

Comment 4 Dominic Geevarghese 2011-02-12 06:34:36 UTC
Ben, thanks for such a wonderful explanation . Yes, I missed the option to blacklist using wwid. 

- dominic