Skip to contentSkip to conversation

master - lvmetad: handle update failures

PATCH David Teigland 1 participant 1 message Jun 7, 2016

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=ed6ffc7a342149dab60086bcabd5fbd2d12ceeb7
Commit:        ed6ffc7a342149dab60086bcabd5fbd2d12ceeb7
Parent:        851ccfccaf3dae184e0bd5f222bdcfcef33fa3b8
Author:        David Teigland <[email protected]>
AuthorDate:    Fri May 20 13:32:14 2016 -0500
Committer:     David Teigland <[email protected]>
CommitterDate: Tue Jun 7 10:17:00 2016 -0500

lvmetad: handle update failures

If a command gets stuck during an lvmetad update, lvmetad will cancel that update after the timeout. The next command to check the lvmetad will see that lvmetad needs to be populated because lvmetad will return token of "none" after a timed out update (same as when lvmetad is not populated at all after starting.)

If a command gets an error during an lvmetad update, it will now just quit and leave its updating token in place. That update will be cancelled after the timeout.

---
 daemons/lvmetad/lvmetactl.c    |   26 +++
 daemons/lvmetad/lvmetad-core.c |  210 +++++++++++++++++++---
 lib/cache/lvmetad.c            |  389 +++++++++++++++++++++++++++++----------
 3 files changed, 498 insertions(+), 127 deletions(-)
daemons/lvmetad/lvmetactl.c +26 -0
index 30ca1d6..dd2ee1e 100644
@@ -55,24 +55,32 @@ int main(int argc, char **argv)
 	if (!strcmp(cmd, "dump")) {
 		reply = daemon_send_simple(h, "dump",
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		printf("%s\n", reply.buffer.mem);
 
 	} else if (!strcmp(cmd, "pv_list")) {
 		reply = daemon_send_simple(h, "pv_list",
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		printf("%s\n", reply.buffer.mem);
 
 	} else if (!strcmp(cmd, "vg_list")) {
 		reply = daemon_send_simple(h, "vg_list",
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		printf("%s\n", reply.buffer.mem);
 
 	} else if (!strcmp(cmd, "get_global_info")) {
 		reply = daemon_send_simple(h, "get_global_info",
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		printf("%s\n", reply.buffer.mem);
 
@@ -86,6 +94,8 @@ int main(int argc, char **argv)
 		reply = daemon_send_simple(h, "set_global_info",
 					   "global_invalid = " FMTd64, (int64_t) val,
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		print_reply(reply);
 
@@ -100,6 +110,8 @@ int main(int argc, char **argv)
 					   "global_disable = " FMTd64, (int64_t) val,
 					   "disable_reason = %s", LVMETAD_DISABLE_REASON_DIRECT,
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		print_reply(reply);
 
@@ -123,18 +135,24 @@ int main(int argc, char **argv)
 						   "name = %s", name,
 						   "version = " FMTd64, (int64_t) ver,
 						   "token = %s", "skip",
+						   "pid = " FMTd64, (int64_t)getpid(),
+						   "cmd = %s", "lvmetactl",
 						   NULL);
 		} else if (uuid) {
 			reply = daemon_send_simple(h, "set_vg_info",
 						   "uuid = %s", uuid,
 						   "version = " FMTd64, (int64_t) ver,
 						   "token = %s", "skip",
+						   "pid = " FMTd64, (int64_t)getpid(),
+						   "cmd = %s", "lvmetactl",
 						   NULL);
 		} else if (name) {
 			reply = daemon_send_simple(h, "set_vg_info",
 						   "name = %s", name,
 						   "version = " FMTd64, (int64_t) ver,
 						   "token = %s", "skip",
+						   "pid = " FMTd64, (int64_t)getpid(),
+						   "cmd = %s", "lvmetactl",
 						   NULL);
 		} else {
 			printf("name or uuid required\n");
@@ -153,6 +171,8 @@ int main(int argc, char **argv)
 		reply = daemon_send_simple(h, "vg_lookup",
 					   "name = %s", name,
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		printf("%s\n", reply.buffer.mem);
 
@@ -166,6 +186,8 @@ int main(int argc, char **argv)
 		reply = daemon_send_simple(h, "vg_lookup",
 					   "uuid = %s", uuid,
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		printf("%s\n", reply.buffer.mem);
 
@@ -182,6 +204,8 @@ int main(int argc, char **argv)
 		reply = daemon_send_simple(h, "vg_lookup",
 					   "uuid = %s", uuid,
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		/* printf("%s\n", reply.buffer.mem); */
 
@@ -208,6 +232,8 @@ int main(int argc, char **argv)
 		reply = daemon_send_simple(h, "pv_lookup",
 					   "uuid = %s", uuid,
 					   "token = %s", "skip",
+					   "pid = " FMTd64, (int64_t)getpid(),
+					   "cmd = %s", "lvmetactl",
 					   NULL);
 		printf("%s\n", reply.buffer.mem);
 
daemons/lvmetad/lvmetad-core.c +183 -27

279 lines not on this page · raw message

lib/cache/lvmetad.c +289 -100

640 lines not on this page · raw message