]> sourceware.org Git - lvm2.git/commitdiff
pvscan: ignore online for shared and foreign PVs
authorDavid Teigland <teigland@redhat.com>
Tue, 5 Mar 2019 21:19:05 +0000 (15:19 -0600)
committerDavid Teigland <teigland@redhat.com>
Tue, 5 Mar 2019 21:19:05 +0000 (15:19 -0600)
Activation would not be allowed anyway, but we can
check for these cases early and avoid wasted time in
pvscan managing online files an attempting activation.

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

index f45114038a4d9def84f2664068ec4a67a66bde85..df217dbc18803297ec8c9255543596e68ee4d7d2 100644 (file)
@@ -1377,4 +1377,6 @@ int vg_strip_outdated_historical_lvs(struct volume_group *vg);
 
 int lv_on_pmem(struct logical_volume *lv);
 
+int vg_is_foreign(struct volume_group *vg);
+
 #endif
index 9efc3559235b6c0523c5c0514266acb10fcc7c67..c50e63364b5a7bdc1eeba4d14310ad87d60fee59 100644 (file)
@@ -5668,3 +5668,8 @@ int lv_on_pmem(struct logical_volume *lv)
        return 0;
 }
 
+int vg_is_foreign(struct volume_group *vg)
+{
+       return _is_foreign_vg(vg);
+}
+
index c48453136a40c18a431830894f403b5ae93f4e40..30f6fe8f3dec2e0ae6c4635f13cd7106fc1e5ad2 100644 (file)
@@ -696,6 +696,18 @@ static int _online_pvscan_one(struct cmd_context *cmd, struct device *dev,
                fmt->ops->destroy_instance(baton.fid);
        }
 
+       if (baton.vg && vg_is_shared(baton.vg)) {
+               log_print("pvscan[%d] PV %s ignore shared VG.", getpid(), dev_name(dev));
+               release_vg(baton.vg);
+               return 1;
+       }
+
+       if (baton.vg && vg_is_foreign(baton.vg)) {
+               log_print("pvscan[%d] PV %s ignore foreign VG.", getpid(), dev_name(dev));
+               release_vg(baton.vg);
+               return 1;
+       }
+
        ret = _online_pv_found(cmd, dev, dev_args, baton.vg, found_vgnames);
 
        release_vg(baton.vg);
This page took 0.046718 seconds and 5 git commands to generate.