summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2014-12-04 16:58:10 -0600
committerDavid Teigland <teigland@redhat.com>2014-12-04 16:58:10 -0600
commitd754161b945b3c76156349b35090f8e9d269512b (patch)
tree42c10214f00cc66c5fd98346922c6de9b57c768a
parent1fff34c918680223d54896e8dcc6d8b33ceeb813 (diff)
downloadlvm2-dev-dct-lvmlockd-G.tar.gz
pvscan: notify lvmlockd of lvmetad updatesdev-dct-lvmlockd-G
lvmlockd keeps track of local vgs so that it can quickly determine if a vg lock request can be ignored (for a local vg) or is needed (for a lockd vg).
-rw-r--r--lib/locking/lvmlockd.c24
-rw-r--r--tools/pvscan.c16
2 files changed, 40 insertions, 0 deletions
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index a3c181e29..be253e848 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -1879,3 +1879,27 @@ int lockd_free_lv(struct cmd_context *cmd, struct volume_group *vg,
}
}
+int lockd_update_local(struct cmd_context *cmd)
+{
+ daemon_reply reply;
+ int result;
+ int ret;
+
+ reply = _lockd_send("update_local",
+ "pid = %d", getpid(),
+ NULL);
+
+ if (!_lockd_result(reply, &result, NULL)) {
+ ret = 0;
+ } else {
+ ret = (result < 0) ? 0 : 1;
+ }
+
+ if (!ret) {
+ log_error("lockd_update_local lvmlockd result %d", result);
+ }
+
+ daemon_reply_destroy(reply);
+
+ return ret;
+}
diff --git a/tools/pvscan.c b/tools/pvscan.c
index 9fcd7d155..1645821ed 100644
--- a/tools/pvscan.c
+++ b/tools/pvscan.c
@@ -314,6 +314,22 @@ out:
sync_local_dev_names(cmd);
unlock_vg(cmd, VG_GLOBAL);
+ /*
+ * lvmlockd wants to know about any new local vgs that
+ * have been added to lvmetad. If not done automatically
+ * here, then an explicit vgchange --lock-start would be
+ * needed to cause lvmlockd to update its list of local vgs
+ * from lvmetad. We could possibly optimize this by only
+ * calling this if a new vg has been found.
+ *
+ * This will do nothing during startup because lvmlockd is
+ * not yet running. lvmlockd will get an initial list of
+ * local vgs from lvmetad when it's started. This call is
+ * for the case when lvmetad/lvmlockd are already running
+ * and a new local vg appears to the system.
+ */
+ lockd_update_local(cmd);
+
return ret;
}