Add "--retry" option to dmsetup to enable "retry remove" logic
PATCH 2/7 Add "--retry" option to dmsetup to enable "retry remove" logic
tools/dmsetup.c | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-)
tools/dmsetup.c +8 -1
@@ -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 ))