Bug 187273 - If dmsetup create is given a table that fails to load, remove the new device transparently
If dmsetup create is given a table that fails to load, remove the new device ...
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: device-mapper (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Alasdair Kergon
Depends On:
Blocks: 181409 185483
  Show dependency treegraph
Reported: 2006-03-29 13:16 EST by Issue Tracker
Modified: 2010-01-11 21:15 EST (History)
6 users (show)

See Also:
Fixed In Version: RHBA-2006-0434
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2006-08-10 17:24:06 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
patch submitted by IBM (622 bytes, patch)
2006-03-29 13:22 EST, Jeff Layton
no flags Details | Diff

  None (edit)
Comment 4 Jeff Layton 2006-03-29 13:20:45 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
Command failed
[root@pe4600 ~]# dmsetup info
Name:              hugo
State:             ACTIVE
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
the problem.
Comment 5 Jeff Layton 2006-03-29 13:22:27 EST
Created attachment 127010 [details]
patch submitted by IBM

This patch was submitted by IBM and seems to correct the problem.
Comment 7 Alasdair Kergon 2006-03-29 13:58:35 EST
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.]
Comment 8 Alasdair Kergon 2006-03-29 14:18:38 EST
Actually, it breaks down into 3 steps, not 2: create, load, resume.
Comment 9 Alasdair Kergon 2006-03-30 10:17:37 EST
Changed upstream.
Comment 12 Alasdair Kergon 2006-03-30 13:51:28 EST
in 1.02.04 upstream
Comment 17 Red Hat Bugzilla 2006-08-10 17:24:07 EDT
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.


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