mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
dmsetup: Produce partial output if dev disappears.
If a device disappears after obtaining the list of devices but before processing it as a member of that list, dmsetup exits with a failure code. Most commands still produce what output they can in these circumstances, but 'ls --tree' and 'info -c' with fields depending on device dependencies didn't. Change this.
This commit is contained in:
parent
5c55c4ac18
commit
34da83d729
@ -1,5 +1,6 @@
|
|||||||
Version 1.02.136 -
|
Version 1.02.136 -
|
||||||
======================================
|
======================================
|
||||||
|
Still produce output when dmsetup dependency tree building finds dev missing.
|
||||||
Check and report pthread_sigmask() failure in dmeventd.
|
Check and report pthread_sigmask() failure in dmeventd.
|
||||||
Check mem alloc fail in _canonicalize_field_ids().
|
Check mem alloc fail in _canonicalize_field_ids().
|
||||||
Use unsigned math when checking more then 31 legs of raid.
|
Use unsigned math when checking more then 31 legs of raid.
|
||||||
|
@ -2707,6 +2707,9 @@ static int _add_dep(CMD_ARGS)
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Create and walk dependency tree
|
* Create and walk dependency tree
|
||||||
|
*
|
||||||
|
* An incomplete _dtree may still be used by the caller,
|
||||||
|
* but the error must be reported.
|
||||||
*/
|
*/
|
||||||
static int _build_whole_deptree(const struct command *cmd)
|
static int _build_whole_deptree(const struct command *cmd)
|
||||||
{
|
{
|
||||||
@ -2724,12 +2727,14 @@ static int _build_whole_deptree(const struct command *cmd)
|
|||||||
|
|
||||||
static int _display_tree(CMD_ARGS)
|
static int _display_tree(CMD_ARGS)
|
||||||
{
|
{
|
||||||
if (!_build_whole_deptree(cmd))
|
int r;
|
||||||
return_0;
|
|
||||||
|
|
||||||
|
r = _build_whole_deptree(cmd);
|
||||||
|
|
||||||
|
if (_dtree)
|
||||||
_display_tree_walk_children(dm_tree_find_node(_dtree, 0, 0), 0);
|
_display_tree_walk_children(dm_tree_find_node(_dtree, 0, 0), 0);
|
||||||
|
|
||||||
return 1;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4471,10 +4476,15 @@ static int _report_init(const struct command *cmd, const char *subcommand)
|
|||||||
selection, NULL, NULL)))
|
selection, NULL, NULL)))
|
||||||
goto_out;
|
goto_out;
|
||||||
|
|
||||||
if ((_report_type & DR_TREE) && cmd && !_build_whole_deptree(cmd)) {
|
r = 1;
|
||||||
|
|
||||||
|
if ((_report_type & DR_TREE) && cmd) {
|
||||||
|
r = _build_whole_deptree(cmd);
|
||||||
|
if (!_dtree) {
|
||||||
err("Internal device dependency tree creation failed.");
|
err("Internal device dependency tree creation failed.");
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!_switches[INTERVAL_ARG])
|
if (!_switches[INTERVAL_ARG])
|
||||||
_int_args[INTERVAL_ARG] = 1; /* 1s default. */
|
_int_args[INTERVAL_ARG] = 1; /* 1s default. */
|
||||||
@ -4484,8 +4494,6 @@ static int _report_init(const struct command *cmd, const char *subcommand)
|
|||||||
if (field_prefixes)
|
if (field_prefixes)
|
||||||
dm_report_set_output_field_name_prefix(_report, "dm_");
|
dm_report_set_output_field_name_prefix(_report, "dm_");
|
||||||
|
|
||||||
r = 1;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (len)
|
if (len)
|
||||||
dm_free(options);
|
dm_free(options);
|
||||||
@ -6782,8 +6790,15 @@ unknown:
|
|||||||
argc--, argv++;
|
argc--, argv++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_switches[COLS_ARG] && !_report_init(cmd, subcommand))
|
/* Default to success */
|
||||||
|
ret = 0;
|
||||||
|
|
||||||
|
if (_switches[COLS_ARG]) {
|
||||||
|
if (!_report_init(cmd, subcommand))
|
||||||
|
ret = 1;
|
||||||
|
if (!_report)
|
||||||
goto_out;
|
goto_out;
|
||||||
|
}
|
||||||
|
|
||||||
if (_switches[COUNT_ARG])
|
if (_switches[COUNT_ARG])
|
||||||
_count = ((uint32_t)_int_args[COUNT_ARG]) ? : UINT32_MAX;
|
_count = ((uint32_t)_int_args[COUNT_ARG]) ? : UINT32_MAX;
|
||||||
@ -6795,14 +6810,17 @@ unknown:
|
|||||||
&_disp_units);
|
&_disp_units);
|
||||||
if (!_disp_factor) {
|
if (!_disp_factor) {
|
||||||
log_error("Invalid --units argument.");
|
log_error("Invalid --units argument.");
|
||||||
|
ret = 1;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Start interval timer. */
|
/* Start interval timer. */
|
||||||
if (_count > 1)
|
if (_count > 1)
|
||||||
if (!_start_timer())
|
if (!_start_timer()) {
|
||||||
|
ret = 1;
|
||||||
goto_out;
|
goto_out;
|
||||||
|
}
|
||||||
|
|
||||||
doit:
|
doit:
|
||||||
multiple_devices = (cmd->repeatable_cmd && argc != 1 &&
|
multiple_devices = (cmd->repeatable_cmd && argc != 1 &&
|
||||||
@ -6819,18 +6837,19 @@ doit:
|
|||||||
if (_count > 1 && r) {
|
if (_count > 1 && r) {
|
||||||
printf("\n");
|
printf("\n");
|
||||||
/* wait for --interval and update timestamps */
|
/* wait for --interval and update timestamps */
|
||||||
if (!_do_report_wait())
|
if (!_do_report_wait()) {
|
||||||
|
ret = 1;
|
||||||
goto_out;
|
goto_out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!r)
|
if (!r) {
|
||||||
|
ret = 1;
|
||||||
goto_out;
|
goto_out;
|
||||||
|
}
|
||||||
} while (--_count);
|
} while (--_count);
|
||||||
|
|
||||||
/* Success */
|
|
||||||
ret = 0;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
if (_report)
|
if (_report)
|
||||||
dm_report_free(_report);
|
dm_report_free(_report);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user