master - pvscan: ignore online for shared and foreign PVs
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=4e20ebd6a1b993b1f04aa13f55b9c5d8ca2ff287 Commit: 4e20ebd6a1b993b1f04aa13f55b9c5d8ca2ff287 Parent: a0c848d4e4a9b53fa1f9cc7a8330fea6b23c07a8 Author: David Teigland <[email protected]> AuthorDate: Tue Mar 5 15:19:05 2019 -0600 Committer: David Teigland <[email protected]> CommitterDate: Tue Mar 5 15:19:05 2019 -0600
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.
--- lib/metadata/metadata-exported.h | 2 ++ lib/metadata/metadata.c | 5 +++++ tools/pvscan.c | 12 ++++++++++++ 3 files changed, 19 insertions(+), 0 deletions(-)
lib/metadata/metadata-exported.h +2 -0
@@ -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
lib/metadata/metadata.c +5 -0
@@ -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); +} +
tools/pvscan.c +12 -0
@@ -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);