1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

pvscan: ignore online for shared and foreign PVs

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.
This commit is contained in:
David Teigland 2019-03-05 15:19:05 -06:00
parent a0c848d4e4
commit 4e20ebd6a1
3 changed files with 19 additions and 0 deletions

View 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

View 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);
}

View 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);