]> sourceware.org Git - lvm2.git/commitdiff
clvmd: skip dev rescan after full scan
authorDavid Teigland <teigland@redhat.com>
Tue, 24 Apr 2018 19:48:30 +0000 (14:48 -0500)
committerDavid Teigland <teigland@redhat.com>
Wed, 25 Apr 2018 21:39:43 +0000 (16:39 -0500)
When clvmd does a full label scan just prior to
calling _vg_read(), pass a new flag into _vg_read
to indicate that the normal rescan of VG devs is
not needed.

lib/metadata/metadata-exported.h
lib/metadata/metadata.c

index 73041cf32aef6edcce416f79b0dbd0409b16da50..e8ecfd641ed505ba2966afdc8632d909ecaa4456 100644 (file)
@@ -645,6 +645,7 @@ void pvcreate_params_set_defaults(struct pvcreate_params *pp);
  */ 
 #define WARN_PV_READ      0x00000001
 #define WARN_INCONSISTENT 0x00000002
+#define SKIP_RESCAN       0x00000004
 
 /*
 * Utility functions
index a9086580df0d8eb6c72a86588cf832ef2f0637f7..3c1d8a46a0ece150b9eecae02df3a7839e174630 100644 (file)
@@ -3864,6 +3864,10 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
         * we can also skip the rescan in that case.
         */
        if (!cmd->can_use_one_scan || lvmcache_scan_mismatch(cmd, vgname, vgid)) {
+               /* the skip rescan special case is for clvmd vg_read_by_vgid */
+               /* FIXME: this is not a warn flag, pass this differently */
+               if (warn_flags & SKIP_RESCAN)
+                       goto find_vg;
                skipped_rescan = 0;
                log_debug_metadata("Rescanning devices for for %s", vgname);
                lvmcache_label_rescan_vg(cmd, vgname, vgid);
@@ -3872,6 +3876,8 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
                skipped_rescan = 1;
        }
 
+ find_vg:
+
        if (!(fmt = lvmcache_fmt_from_vgname(cmd, vgname, vgid, 0))) {
                log_debug_metadata("Cache did not find fmt for vgname %s", vgname);
                return_NULL;
@@ -4593,6 +4599,7 @@ struct volume_group *vg_read_by_vgid(struct cmd_context *cmd,
                lvmcache_destroy(cmd, 0, 0);
                label_scan_destroy(cmd);
                lvmcache_label_scan(cmd);
+               warn_flags |= SKIP_RESCAN;
        }
 
        if (!(vgname = lvmcache_vgname_from_vgid(cmd->mem, vgid))) {
@@ -4623,6 +4630,7 @@ struct volume_group *vg_read_by_vgid(struct cmd_context *cmd,
        lvmcache_destroy(cmd, 0, 0);
        label_scan_destroy(cmd);
        lvmcache_label_scan(cmd);
+       warn_flags |= SKIP_RESCAN;
 
        if (!(vg = _vg_read(cmd, vgname, vgid, warn_flags, &consistent, precommitted)))
                goto fail;
This page took 0.043638 seconds and 5 git commands to generate.