summaryrefslogtreecommitdiff
path: root/lib/device/dev-cache.c
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2015-12-11 14:02:36 -0600
committerDavid Teigland <teigland@redhat.com>2015-12-11 14:20:00 -0600
commit90cf5acff15a26d87d4cabf6601e82846d608a69 (patch)
tree43116806c72f680d73484de614de1265ace5c71d /lib/device/dev-cache.c
parent3e48354f2d458e80cab4c096b2869bdc1ad463c3 (diff)
downloadlvm2-dev-dct-dev-cache-full-scan.tar.gz
process_each_pv: do full scan earlier to find new devicesdev-dct-dev-cache-full-scan
Before commit c1f246fedfc349c25749da501e68a7f70bd122b0, _get_all_devices() did a full device scan before get_vgnameids() was called. New devices would be added to the dev-cache before label scanning done by get_vgnameids. So, labels would be read from new devices by the first 'pvs' command. After that commit, _get_all_devices() was called after get_vgnameids() was finished with label scanning. So, new devices would be missed by the label scanning, and would not appear to be lvm devices to the first 'pvs' command. A new device would be added to .cache by the first command, so the second 'pvs' command would scan labels from it in get_vgnameids(). Now, the full device scan is factored out of get_all_devices() and called by itself at the start of the command so that new devices will be known before get_vgnameids() scans labels.
Diffstat (limited to 'lib/device/dev-cache.c')
-rw-r--r--lib/device/dev-cache.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/lib/device/dev-cache.c b/lib/device/dev-cache.c
index 7626cebbd..97165dbf8 100644
--- a/lib/device/dev-cache.c
+++ b/lib/device/dev-cache.c
@@ -1026,6 +1026,16 @@ struct device *dev_cache_get_by_devt(dev_t dev, struct dev_filter *f)
f->passes_filter(f, d))) ? d : NULL;
}
+void dev_cache_full_scan(struct dev_filter *f)
+{
+ if (f && f->wipe) {
+ f->wipe(f); /* might call _full_scan(1) */
+ if (!full_scan_done())
+ _full_scan(1);
+ } else
+ _full_scan(1);
+}
+
struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan)
{
struct dev_iter *di = dm_malloc(sizeof(*di));
@@ -1037,14 +1047,8 @@ struct dev_iter *dev_iter_create(struct dev_filter *f, int dev_scan)
if (dev_scan && !trust_cache()) {
/* Flag gets reset between each command */
- if (!full_scan_done()) {
- if (f && f->wipe) {
- f->wipe(f); /* might call _full_scan(1) */
- if (!full_scan_done())
- _full_scan(1);
- } else
- _full_scan(1);
- }
+ if (!full_scan_done())
+ dev_cache_full_scan(f);
} else
_full_scan(0);