aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2015-09-09 13:20:37 -0500
committerDavid Teigland <teigland@redhat.com>2015-09-10 09:47:26 -0500
commit36d16fed1fe883cf2c2756212fd0e6b2f1f99e6b (patch)
tree47666adff7b30c42c75deda5b5c3499135329ff5
parent30e489db5e05296e22037bd885d074d395ab46f4 (diff)
downloadlvm2-36d16fed1fe883cf2c2756212fd0e6b2f1f99e6b.tar.gz
lockd: add start_init arg to lockd_start_vg
Add a new arg to lockd_start_vg() that indicates it is being called for a new lockd VG, so that lvmlockd knows the lockspace being started is new. (Will be used by a following commit.)
-rw-r--r--lib/locking/lvmlockd.c15
-rw-r--r--lib/locking/lvmlockd.h4
-rw-r--r--tools/vgchange.c2
-rw-r--r--tools/vgcreate.c2
4 files changed, 14 insertions, 9 deletions
diff --git a/lib/locking/lvmlockd.c b/lib/locking/lvmlockd.c
index a726d873f..597a96474 100644
--- a/lib/locking/lvmlockd.c
+++ b/lib/locking/lvmlockd.c
@@ -921,9 +921,13 @@ void lockd_free_vg_final(struct cmd_context *cmd, struct volume_group *vg)
* for starting the lockspace. To use the vg after starting
* the lockspace, follow the standard method which is:
* lock the vg, read/use/write the vg, unlock the vg.
+ *
+ * start_init is 1 when the VG is being started after the
+ * command has done lockd_init_vg(). This tells lvmlockd
+ * that the VG lockspace being started is new.
*/
-int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg)
+int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg, int start_init)
{
char uuid[64] __attribute__((aligned(8)));
daemon_reply reply;
@@ -945,8 +949,8 @@ int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg)
return 0;
}
- log_debug("lockd start VG %s lock_type %s",
- vg->name, vg->lock_type ? vg->lock_type : "empty");
+ log_debug("lockd start VG %s lock_type %s init %d",
+ vg->name, vg->lock_type ? vg->lock_type : "empty", start_init);
if (!id_write_format(&vg->id, uuid, sizeof(uuid)))
return_0;
@@ -973,6 +977,7 @@ int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg)
"vg_uuid = %s", uuid[0] ? uuid : "none",
"version = %d", (int64_t)vg->seqno,
"host_id = %d", host_id,
+ "opts = %s", start_init ? "start_init" : "none",
NULL);
if (!_lockd_result(reply, &result, NULL)) {
@@ -2461,7 +2466,7 @@ int lockd_rename_vg_final(struct cmd_context *cmd, struct volume_group *vg, int
* Depending on the problem that caused the rename to
* fail, it may make sense to not restart the VG here.
*/
- if (!lockd_start_vg(cmd, vg))
+ if (!lockd_start_vg(cmd, vg, 0))
log_error("Failed to restart VG %s lockspace.", vg->name);
return 1;
}
@@ -2501,7 +2506,7 @@ int lockd_rename_vg_final(struct cmd_context *cmd, struct volume_group *vg, int
}
}
- if (!lockd_start_vg(cmd, vg))
+ if (!lockd_start_vg(cmd, vg, 1))
log_error("Failed to start VG %s lockspace.", vg->name);
return 1;
diff --git a/lib/locking/lvmlockd.h b/lib/locking/lvmlockd.h
index 51c2905de..7e6505de9 100644
--- a/lib/locking/lvmlockd.h
+++ b/lib/locking/lvmlockd.h
@@ -62,7 +62,7 @@ int lockd_rename_vg_final(struct cmd_context *cmd, struct volume_group *vg, int
/* start and stop the lockspace for a vg */
-int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg);
+int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg, int start_init);
int lockd_stop_vg(struct cmd_context *cmd, struct volume_group *vg);
int lockd_start_wait(struct cmd_context *cmd);
@@ -147,7 +147,7 @@ static inline int lockd_rename_vg_final(struct cmd_context *cmd, struct volume_g
return 1;
}
-static inline int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg)
+static inline int lockd_start_vg(struct cmd_context *cmd, struct volume_group *vg, int start_init)
{
return 0;
}
diff --git a/tools/vgchange.c b/tools/vgchange.c
index a80b678a6..81e4bf30f 100644
--- a/tools/vgchange.c
+++ b/tools/vgchange.c
@@ -878,7 +878,7 @@ static int _vgchange_lock_start(struct cmd_context *cmd, struct volume_group *vg
}
do_start:
- return lockd_start_vg(cmd, vg);
+ return lockd_start_vg(cmd, vg, 0);
}
static int _vgchange_lock_stop(struct cmd_context *cmd, struct volume_group *vg)
diff --git a/tools/vgcreate.c b/tools/vgcreate.c
index 67b593dcc..fd7956382 100644
--- a/tools/vgcreate.c
+++ b/tools/vgcreate.c
@@ -157,7 +157,7 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
if (is_lockd_type(vg->lock_type)) {
const char *start_opt = arg_str_value(cmd, lockopt_ARG, NULL);
- if (!lockd_start_vg(cmd, vg)) {
+ if (!lockd_start_vg(cmd, vg, 1)) {
log_error("Failed to start locking");
goto out;
}