public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
* LVM2 ./WHATS_NEW daemons/clvmd/refresh_clvmd.c
@ 2011-09-21 13:40 mbroz
  0 siblings, 0 replies; 4+ messages in thread
From: mbroz @ 2011-09-21 13:40 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2011-09-21 13:40:47

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : refresh_clvmd.c 

Log message:
	Always sent the whole command header in restart/reload clvmd commands.
	(Newly added check catch this as invalid packet.)
	
	(N.B. that code is so fragile that it need full rewrite soon:-)

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.2126&r2=1.2127
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/refresh_clvmd.c.diff?cvsroot=lvm2&r1=1.15&r2=1.16

--- LVM2/WHATS_NEW	2011/09/21 10:42:53	1.2126
+++ LVM2/WHATS_NEW	2011/09/21 13:40:46	1.2127
@@ -1,5 +1,6 @@
 Version 2.02.89 - 
 ==================================
+  Always send the whole clvmd packet header in refresh commands.
   Add missing error checks for some system calls in cmirrord.
   Add missing log_error() to lvresize command when fsadm tool fails.
   Add support for DM_DEV_DIR device path into fsadm script.
--- LVM2/daemons/clvmd/refresh_clvmd.c	2011/04/08 14:40:18	1.15
+++ LVM2/daemons/clvmd/refresh_clvmd.c	2011/09/21 13:40:46	1.16
@@ -149,14 +149,20 @@
 
 /* Build the structure header and parse-out wildcard node names */
 static void _build_header(struct clvm_header *head, int cmd, const char *node,
-			  int len)
+			  unsigned int len)
 {
 	head->cmd = cmd;
 	head->status = 0;
 	head->flags = 0;
 	head->xid = 0;
 	head->clientid = 0;
-	head->arglen = len;
+	if (len)
+		/* 1 byte is used from struct clvm_header.args[1], so -> len - 1 */
+		head->arglen = len - 1;
+	else {
+		head->arglen = 0;
+		*head->args = '\0';
+	}
 
 	if (node) {
 		/*
@@ -198,12 +204,12 @@
 	if (_clvmd_sock == -1)
 		return 0;
 
-	/* 1 byte is used from struct clvm_header.args[1], so -> len - 1 */
-	_build_header(head, cmd, node, len - 1);
-	memcpy(head->node + strlen(head->node) + 1, data, len);
+	_build_header(head, cmd, node, len);
+	if (len)
+		memcpy(head->node + strlen(head->node) + 1, data, len);
 
 	status = _send_request(outbuf, sizeof(struct clvm_header) +
-			       strlen(head->node) + len - 1, &retbuf, no_response);
+			       strlen(head->node) + len, &retbuf, no_response);
 	if (!status || no_response)
 		goto out;
 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/refresh_clvmd.c
@ 2010-07-01 21:46 mbroz
  0 siblings, 0 replies; 4+ messages in thread
From: mbroz @ 2010-07-01 21:46 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-07-01 21:46:09

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : refresh_clvmd.c 

Log message:
	Fix another segfault in clvmd -R if no response from daemon received.
	
	Missed the same problem in another function...

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1647&r2=1.1648
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/refresh_clvmd.c.diff?cvsroot=lvm2&r1=1.12&r2=1.13

--- LVM2/WHATS_NEW	2010/07/01 21:23:47	1.1647
+++ LVM2/WHATS_NEW	2010/07/01 21:46:09	1.1648
@@ -1,5 +1,6 @@
 Version 2.02.70 - 
 ================================
+  Fix another segfault in clvmd -R if no response from daemon received. (2.02.68)
   Remove superfluous suspended device counter from clvmd.
   Fix lvm shell crash when input is entirely whitespace.
   Update partial mode warning message.
--- LVM2/daemons/clvmd/refresh_clvmd.c	2010/06/21 15:56:58	1.12
+++ LVM2/daemons/clvmd/refresh_clvmd.c	2010/07/01 21:46:09	1.13
@@ -285,7 +285,7 @@
 {
 	int num_responses;
 	char args[1]; // No args really.
-	lvm_response_t *response;
+	lvm_response_t *response = NULL;
 	int saved_errno;
 	int status;
 	int i;


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/refresh_clvmd.c
@ 2010-06-21 10:45 mbroz
  0 siblings, 0 replies; 4+ messages in thread
From: mbroz @ 2010-06-21 10:45 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-06-21 10:45:17

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : refresh_clvmd.c 

Log message:
	Let running clvmd process time to reexec.
	
	Because execve stops the command loop,
	we never receive response (only socket close) for clvmd -S,
	so waiting for response here makes no sense.
	
	But if the calling process (clvmd -S)  exits too early, connection
	is closed from client side, clvmd takes this as an error and
	never run restart code.
	
	Ugly hack(TM).

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1620&r2=1.1621
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/refresh_clvmd.c.diff?cvsroot=lvm2&r1=1.10&r2=1.11

--- LVM2/WHATS_NEW	2010/06/21 08:54:32	1.1620
+++ LVM2/WHATS_NEW	2010/06/21 10:45:15	1.1621
@@ -1,5 +1,6 @@
 Version 2.02.68 -
 ===============================
+  Add workaround for clvmd -S (socket closed too early and server drops the command).
   Use early udev synchronisation and update of dev nodes for clustered mirrors.
   Unneeded kdev_t.h reference causing harm for cmirrord on some archs.
   Add man pages for lvmconf and unsupported lvmsadc and lvmsar tools.
--- LVM2/daemons/clvmd/refresh_clvmd.c	2010/06/15 11:00:45	1.10
+++ LVM2/daemons/clvmd/refresh_clvmd.c	2010/06/21 10:45:16	1.11
@@ -327,8 +327,21 @@
 
 int restart_clvmd(int all_nodes)
 {
-	int dummy;
-	return _cluster_request(CLVMD_CMD_RESTART, all_nodes?"*":".", NULL, 0, NULL, &dummy, 1);
+	int dummy, status;
+
+	status = _cluster_request(CLVMD_CMD_RESTART, all_nodes?"*":".", NULL, 0, NULL, &dummy, 1);
+
+	/*
+	 * FIXME: we cannot receive response, clvmd re-exec before it.
+	 *        but also should not close socket too early (the whole rq is dropped then).
+	 * FIXME: This should be handled this way:
+	 *  - client waits for RESTART ack (and socket close)
+	 *  - server restarts
+	 *  - client checks that server is ready again (VERSION command?)
+	 */
+	usleep(500000);
+
+	return status;
 }
 
 int debug_clvmd(int level, int clusterwide)


^ permalink raw reply	[flat|nested] 4+ messages in thread

* LVM2 ./WHATS_NEW daemons/clvmd/refresh_clvmd.c
@ 2010-06-07 13:52 mbroz
  0 siblings, 0 replies; 4+ messages in thread
From: mbroz @ 2010-06-07 13:52 UTC (permalink / raw)
  To: lvm-devel, lvm2-cvs

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	mbroz@sourceware.org	2010-06-07 13:52:53

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : refresh_clvmd.c 

Log message:
	Fix segfault in clvmd -R if no response from daemon received.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1609&r2=1.1610
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/refresh_clvmd.c.diff?cvsroot=lvm2&r1=1.8&r2=1.9

--- LVM2/WHATS_NEW	2010/06/07 10:25:43	1.1609
+++ LVM2/WHATS_NEW	2010/06/07 13:52:52	1.1610
@@ -1,5 +1,6 @@
 Version 2.02.68 -
 ===============================
+  Fix segfault in clvmd -R if no response from daemon received.
 
 Version 2.02.67 - 4th June 2010
 ===============================
--- LVM2/daemons/clvmd/refresh_clvmd.c	2010/04/20 14:07:38	1.8
+++ LVM2/daemons/clvmd/refresh_clvmd.c	2010/06/07 13:52:53	1.9
@@ -336,7 +336,7 @@
 	int num_responses;
 	char args[1];
 	const char *nodes;
-	lvm_response_t *response;
+	lvm_response_t *response = NULL;
 	int saved_errno;
 	int status;
 	int i;


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-09-21 13:40 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-21 13:40 LVM2 ./WHATS_NEW daemons/clvmd/refresh_clvmd.c mbroz
  -- strict thread matches above, loose matches on Subject: below --
2010-07-01 21:46 mbroz
2010-06-21 10:45 mbroz
2010-06-07 13:52 mbroz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).