summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-05-24 12:14:44 -0500
committerDavid Teigland <teigland@redhat.com>2016-05-24 12:14:44 -0500
commitc391117eaa92ae5a8ae50fa2f1f81d87f406cc28 (patch)
treeee02860cc9de44330e0ec942828f31e5845d74be
parent7fffcce9247cba8ecb40a1c7b0c6d18a5cde2165 (diff)
downloadlvm2-dev-dct-toollib-scan.tar.gz
process_each: explicitly check for existing devicesdev-dct-toollib-scan
For an ordinary command, dev_cache_full_scan is always run but is called as a side effect of something else. Instead, run it explicitly at the start of process_each, rather than depending on some later side effect to do it. Some cases, like lvm shell, do not reliably trigger the dev_cache_full_scan side effect and do not see that some devices exist.
-rw-r--r--tools/toollib.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/tools/toollib.c b/tools/toollib.c
index 538373480..82fb48ffb 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -2137,14 +2137,19 @@ int process_each_vg(struct cmd_context *cmd,
}
/*
+ * If this were not called here, it would be called as a side effect
+ * of something else later on. But sometimes, e.g. lvm shell, that
+ * side effect cannot be relied on, so make it explicit here.
+ */
+ dev_cache_full_scan(cmd->full_filter);
+
+ /*
* First rescan for available devices, then force the next
* label scan to be done. get_vgnameids() will scan labels
* (when not using lvmetad).
*/
- if (cmd->command->flags & REQUIRES_FULL_LABEL_SCAN) {
- dev_cache_full_scan(cmd->full_filter);
+ if (cmd->command->flags & REQUIRES_FULL_LABEL_SCAN)
lvmcache_force_next_label_scan();
- }
/*
* A list of all VGs on the system is needed when:
@@ -2754,6 +2759,13 @@ int process_each_lv(struct cmd_context *cmd, int argc, char **argv, uint32_t rea
}
/*
+ * If this were not called here, it would be called as a side effect
+ * of something else later on. But sometimes, e.g. lvm shell, that
+ * side effect cannot be relied on, so make it explicit here.
+ */
+ dev_cache_full_scan(cmd->full_filter);
+
+ /*
* A list of all VGs on the system is needed when:
* . processing all VGs on the system
* . A VG name is specified which may refer to one