]> sourceware.org Git - lvm2.git/commitdiff
Add --retry option for dmsetup remove to retry removal if not successful.
authorPeter Rajnoha <prajnoha@redhat.com>
Thu, 22 Sep 2011 17:12:28 +0000 (17:12 +0000)
committerPeter Rajnoha <prajnoha@redhat.com>
Thu, 22 Sep 2011 17:12:28 +0000 (17:12 +0000)
WHATS_NEW_DM
man/dmsetup.8.in
tools/dmsetup.c

index 0ed1a14a0140944e17bbab9109bffe8e2dfa509d..782423ea54f618431597abc6543da42b57960784 100644 (file)
@@ -1,5 +1,6 @@
 Version 1.02.68 -
 ==================================
+  Add --retry option for dmsetup remove to retry removal if not successful.
   Add dm_task_retry_remove fn to use retry logic for device removal.
   Remove unused passed parameters for _mirror_emit_segment_line().
   Add dm_config and string character escaping functions to libdevmapper.
index 175a429e658b5a8f98477c5712a7665e517fb648..f75126cb4abfddbd8e484d0ac5a252e6a186e035 100644 (file)
@@ -11,7 +11,7 @@ dmsetup \- low level logical volume management
 .I [{ --addnodeonresume | --addnodeoncreate }]
 .br
 .B dmsetup remove
-.I [-f|--force] device_name
+.I [-f|--force] [--retry] device_name
 .br
 .B dmsetup remove_all
 .I [-f|--force]
@@ -280,7 +280,7 @@ If no device_name is supplied, ensure that all nodes in /dev/mapper
 correspond to mapped devices currently loaded by the device-mapper kernel
 driver, adding, changing or removing nodes as necessary.
 .IP \fBremove
-.I [-f|--force] device_name
+.I [-f|--force] [--retry] device_name
 .br
 Removes a device.  It will no longer be visible to dmsetup.
 Open devices cannot be removed except with older kernels
@@ -290,7 +290,10 @@ drops to zero.  From version 4.8.0 onwards, if a device can't
 be removed because an uninterruptible process is waiting for
 I/O to return from it, adding --force will replace the table 
 with one that fails all I/O, which might allow the 
-process to be killed.
+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.
 .IP \fBremove_all
 .I [-f|--force]
 .br
index fbdbc6acb6413cd5453856954aa3180fa578e919..f35c8a53d988bfa4bb938b33840ce27645cf927a 100644 (file)
@@ -140,6 +140,7 @@ enum {
        NOUDEVSYNC_ARG,
        OPTIONS_ARG,
        READAHEAD_ARG,
+       RETRY_ARG,
        ROWS_ARG,
        SEPARATOR_ARG,
        SETUUID_ARG,
@@ -1279,6 +1280,9 @@ static int _simple(int task, const char *name, uint32_t event_nr, int display)
        if (udev_wait_flag && !dm_task_set_cookie(dmt, &cookie, udev_flags))
                goto out;
 
+       if (_switches[RETRY_ARG] && task == DM_DEVICE_REMOVE)
+               dm_task_retry_remove(dmt);
+
        r = dm_task_run(dmt);
 
       out:
@@ -2805,7 +2809,7 @@ static void _usage(FILE *out)
                "        [--checks] [-v|--verbose [-v|--verbose ...]]\n"
                "        [-r|--readonly] [--noopencount] [--nolockfs] [--inactive]\n"
                "        [--udevcookie [cookie]] [--noudevrules] [--noudevsync] [--verifyudev]\n"
-               "        [-y|--yes] [--readahead [+]<sectors>|auto|none]\n"
+               "        [-y|--yes] [--readahead [+]<sectors>|auto|none] [--retry]\n"
                "        [-c|-C|--columns] [-o <fields>] [-O|--sort <sort_fields>]\n"
                "        [--nameprefixes] [--noheadings] [--separator <separator>]\n\n");
        for (i = 0; _commands[i].name; i++)
@@ -3178,6 +3182,7 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
                {"noudevsync", 0, &ind, NOUDEVSYNC_ARG},
                {"options", 1, &ind, OPTIONS_ARG},
                {"readahead", 1, &ind, READAHEAD_ARG},
+               {"retry", 0, &ind, RETRY_ARG},
                {"rows", 0, &ind, ROWS_ARG},
                {"separator", 1, &ind, SEPARATOR_ARG},
                {"setuuid", 0, &ind, SETUUID_ARG},
@@ -3362,6 +3367,8 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir)
                                }
                        }
                }
+               if ((ind == RETRY_ARG))
+                       _switches[RETRY_ARG]++;
                if ((ind == ROWS_ARG))
                        _switches[ROWS_ARG]++;
                if ((ind == SETUUID_ARG))
This page took 0.040868 seconds and 5 git commands to generate.