1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

dmsetup: add warning

Warn when --udevcookie/DM_UDEV_COOKIE is used with 'dmsetup remove --force'.

When command is doing multiple ioctl operations on a single device,
it may invoke udev activity, that is colliding with further ioctl commands.
The result of such operation becomes unpredictable.
Use of --retry could partially help...
This commit is contained in:
Zdenek Kabelac 2014-05-26 22:51:04 +02:00
parent 6e9105c7bb
commit 3cb2658fb7
3 changed files with 16 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 1.02.88 -
=================================
Warn user about incorrect use of cookie with 'dmsetup remove --force'.
Also recognize 'help'/'?' as reserved sort key name to show help.
Export recognized DM_REPORT_FIELD_RESERVED_NAME_{HELP,HELP_ALT} to show help.
Add dm_units_to_factor for size unit parsing.

View File

@ -243,6 +243,9 @@ Specify a one-line table directly on the command line.
.TP
.B \-\-udevcookie \fIcookie
Use cookie for udev synchronisation.
Note: Same cookie should be used for same type of operations i.e. creation of
multiple different devices. It's not adviced to combine different
operations on the single device.
.TP
.BR \-u | \-\-uuid
Specify the uuid.
@ -429,6 +432,9 @@ process to be killed. If an attempt to remove a device fails,
perhaps because a process run from a quick udev rule
temporarily opened the device, the \-\-retry option will cause
the operation to be retried for a few seconds before failing.
Do NOT combine \fB\-\-force\fP and \fB\-\-udevcookie\fP,
as udev may start to process udev rules in the middle of error target
replacement and result in nondeterministic result.
.br
.HP
.B remove_all

View File

@ -1498,8 +1498,16 @@ error:
static int _remove(CMD_ARGS)
{
if (_switches[FORCE_ARG] && argc > 1)
if (_switches[FORCE_ARG] && argc > 1) {
/*
* 'remove --force' option is doing 2 operations on the same device
* this is not compatible with the use of --udevcookie/DM_UDEV_COOKIE.
* Udevd collision could be partially avoided with --retry.
*/
if (_udev_cookie)
log_warn("WARNING: Use of cookie and --force is not compatible.");
(void) _error_device(cmd, argc, argv, NULL, 0);
}
return _simple(DM_DEVICE_REMOVE, argc > 1 ? argv[1] : NULL, 0, 0);
}