summaryrefslogtreecommitdiff
path: root/daemons/lvmlockd
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2019-03-07 11:20:41 -0600
committerDavid Teigland <teigland@redhat.com>2019-03-21 12:38:20 -0500
commit9b4926aaff7f8644c8492cd68ab0b7079416ef3a (patch)
treee260028d1360f16ca226496a0f7a89c354bcc580 /daemons/lvmlockd
parent7f757ab6166074dd3286983c05a30623095845ff (diff)
downloadlvm2-9b4926aaff7f8644c8492cd68ab0b7079416ef3a.tar.gz
warn about changes to an active lv with shared lock
When an LV is active with a shared lock, a command can be run to change the LV with --lockopt skiplv (to override the exclusive lock the command ordinarily requires which is not compatible with the outstanding shared lock.) In this case, other commands may have the LV active and may need to refresh the LV, so print warning stating this.
Diffstat (limited to 'daemons/lvmlockd')
-rw-r--r--daemons/lvmlockd/lvmlockd-core.c41
-rw-r--r--daemons/lvmlockd/lvmlockd-internal.h1
2 files changed, 42 insertions, 0 deletions
diff --git a/daemons/lvmlockd/lvmlockd-core.c b/daemons/lvmlockd/lvmlockd-core.c
index 60ae537e2..40a2f21b6 100644
--- a/daemons/lvmlockd/lvmlockd-core.c
+++ b/daemons/lvmlockd/lvmlockd-core.c
@@ -725,6 +725,8 @@ static const char *op_str(int x)
return "rename_final";
case LD_OP_RUNNING_LM:
return "running_lm";
+ case LD_OP_QUERY_LOCK:
+ return "query_lock";
case LD_OP_FIND_FREE_LOCK:
return "find_free_lock";
case LD_OP_KILL_VG:
@@ -2196,6 +2198,7 @@ static int process_op_during_kill(struct action *act)
case LD_OP_UPDATE:
case LD_OP_RENAME_BEFORE:
case LD_OP_RENAME_FINAL:
+ case LD_OP_QUERY_LOCK:
case LD_OP_FIND_FREE_LOCK:
return 0;
};
@@ -2420,6 +2423,19 @@ static void *lockspace_thread_main(void *arg_in)
break;
}
+ if (act->op == LD_OP_QUERY_LOCK) {
+ r = find_resource_act(ls, act, 0);
+ if (!r)
+ act->result = -ENOENT;
+ else {
+ act->result = 0;
+ act->mode = r->mode;
+ }
+ list_del(&act->list);
+ add_client_result(act);
+ continue;
+ }
+
if (act->op == LD_OP_FIND_FREE_LOCK && act->rt == LD_RT_VG) {
uint64_t free_offset = 0;
int sector_size = 0;
@@ -3673,6 +3689,20 @@ static int client_send_result(struct client *cl, struct action *act)
"result_flags = %s", result_flags[0] ? result_flags : "none",
NULL);
+ } else if (act->op == LD_OP_QUERY_LOCK) {
+
+ log_debug("send %s[%d] cl %u %s %s rv %d mode %d",
+ cl->name[0] ? cl->name : "client", cl->pid, cl->id,
+ op_str(act->op), rt_str(act->rt),
+ act->result, act->mode);
+
+ res = daemon_reply_simple("OK",
+ "op = " FMTd64, (int64_t)act->op,
+ "op_result = " FMTd64, (int64_t) act->result,
+ "lock_type = %s", lm_str(act->lm_type),
+ "mode = %s", mode_str(act->mode),
+ NULL);
+
} else if (act->op == LD_OP_DUMP_LOG || act->op == LD_OP_DUMP_INFO) {
/*
* lvmlockctl creates the unix socket then asks us to write to it.
@@ -4003,6 +4033,16 @@ static int str_to_op_rt(const char *req_name, int *op, int *rt)
*rt = 0;
return 0;
}
+ if (!strcmp(req_name, "query_lock_vg")) {
+ *op = LD_OP_QUERY_LOCK;
+ *rt = LD_RT_VG;
+ return 0;
+ }
+ if (!strcmp(req_name, "query_lock_lv")) {
+ *op = LD_OP_QUERY_LOCK;
+ *rt = LD_RT_LV;
+ return 0;
+ }
if (!strcmp(req_name, "find_free_lock")) {
*op = LD_OP_FIND_FREE_LOCK;
*rt = LD_RT_VG;
@@ -4582,6 +4622,7 @@ static void client_recv_action(struct client *cl)
case LD_OP_DISABLE:
case LD_OP_FREE:
case LD_OP_RENAME_BEFORE:
+ case LD_OP_QUERY_LOCK:
case LD_OP_FIND_FREE_LOCK:
case LD_OP_KILL_VG:
case LD_OP_DROP_VG:
diff --git a/daemons/lvmlockd/lvmlockd-internal.h b/daemons/lvmlockd/lvmlockd-internal.h
index 04645fad9..f0fa85fbc 100644
--- a/daemons/lvmlockd/lvmlockd-internal.h
+++ b/daemons/lvmlockd/lvmlockd-internal.h
@@ -53,6 +53,7 @@ enum {
LD_OP_KILL_VG,
LD_OP_DROP_VG,
LD_OP_BUSY,
+ LD_OP_QUERY_LOCK,
};
/* resource types */