Red Hat Bugzilla – Bug 187273
If dmsetup create is given a table that fails to load, remove the new device transparently
Last modified: 2010-01-11 21:15:54 EST
Short synopsis for engineering...
When a dmsetup create fails with an invalid argument (and maybe in other
sitations as well), the device is still created in an inconsistent state:
[root@pe4600 ~]# echo "0 14424288 linear /dev/sdc1 -1" | dmsetup create hugo
device-mapper: reload ioctl failed: Invalid argument
[root@pe4600 ~]# dmsetup info
Tables present: None
Open count: 0
Event number: 0
Major, minor: 253, 0
Number of targets: 0
I've replicated this behavior here. The patch submitted by IBM seems to correct
Created attachment 127010 [details]
patch submitted by IBM
This patch was submitted by IBM and seems to correct the problem.
With version 4 of the ioctl interface (the current version), 'dmsetup create'
with a table supplied is a shortcut for 'dmsetup create --notable' followed by
'dmsetup load' using the table. This is handled transparently within
libdevmapper and helps to make version 4 compatible with version 1.
The proposal here is to extend that shortcut such that if the load fails, a
dmsetup remove is issued.
The patch is unsatisfactory as it stands because it attempts an unnecessary
remove if the DM_DEVICE_CREATE fails. The removal should be handled within
libdevmapper itself. I can't think of any code relying on the existing failure
mode, so I think it is a reasonable thing to change.
[Even after this change of course, scripts that care about error handling are
better off doing dmsetup create --notable followed by dmsetup load.]
Actually, it breaks down into 3 steps, not 2: create, load, resume.
in 1.02.04 upstream
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.