summaryrefslogtreecommitdiffstats
path: root/tools/pvscan.c
diff options
context:
space:
mode:
authorAlasdair Kergon <agk@redhat.com>2007-08-23 15:02:26 +0000
committerAlasdair Kergon <agk@redhat.com>2007-08-23 15:02:26 +0000
commite935d217520c85eae165cbff0e31065f97a98160 (patch)
tree11a1bee289e7661c9d95f27e9039a59cea5abb4a /tools/pvscan.c
parentf608f304071449c72b147e1dfe29a907ff40bfa8 (diff)
downloadlvm2-e935d217520c85eae165cbff0e31065f97a98160.tar.gz
lvm2-e935d217520c85eae165cbff0e31065f97a98160.tar.xz
lvm2-e935d217520c85eae165cbff0e31065f97a98160.zip
Introduce VG_GLOBAL lock type for vgscan/pvscan to trigger clvmd -R.
Diffstat (limited to 'tools/pvscan.c')
-rw-r--r--tools/pvscan.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 1e358a24..8299cc98 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -124,12 +124,19 @@ int pvscan(struct cmd_context *cmd, int argc __attribute((unused)),
arg_count(cmd, exported_ARG) ?
"of exported volume group(s)" : "in no volume group");
+ if (!lock_vol(cmd, VG_GLOBAL, LCK_VG_WRITE)) {
+ log_error("Unable to obtain global lock.");
+ return ECMD_FAILED;
+ }
+
persistent_filter_wipe(cmd->filter);
lvmcache_destroy();
log_verbose("Walking through all physical volumes");
- if (!(pvslist = get_pvs(cmd)))
+ if (!(pvslist = get_pvs(cmd))) {
+ unlock_vg(cmd, VG_GLOBAL);
return ECMD_FAILED;
+ }
/* eliminate exported/new if required */
list_iterate_items(pvl, pvslist) {
@@ -181,6 +188,7 @@ int pvscan(struct cmd_context *cmd, int argc __attribute((unused)),
if (!pvs_found) {
log_print("No matching physical volumes found");
+ unlock_vg(cmd, VG_GLOBAL);
return ECMD_PROCESSED;
}
@@ -191,5 +199,7 @@ int pvscan(struct cmd_context *cmd, int argc __attribute((unused)),
display_size(cmd, (size_total - size_new)),
new_pvs_found, display_size(cmd, size_new));
+ unlock_vg(cmd, VG_GLOBAL);
+
return ECMD_PROCESSED;
}