]> sourceware.org Git - lvm2.git/commitdiff
Always sent the whole command header in restart/reload clvmd commands.
authorMilan Broz <mbroz@redhat.com>
Wed, 21 Sep 2011 13:40:46 +0000 (13:40 +0000)
committerMilan Broz <mbroz@redhat.com>
Wed, 21 Sep 2011 13:40:46 +0000 (13:40 +0000)
(Newly added check catch this as invalid packet.)

(N.B. that code is so fragile that it need full rewrite soon:-)

WHATS_NEW
daemons/clvmd/refresh_clvmd.c

index 7a341360bb6009da19573d727c7f3190db4e284a..e644845e5f97838981f266cf545caec808272f40 100644 (file)
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -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.
index 2a8130d75d9d5f3b68ec6e43908eeda886cc7417..6fdc53a22dd0677f61f3625fcbbaa3b07427997f 100644 (file)
@@ -149,14 +149,20 @@ static int _send_request(const char *inbuf, int inlen, char **retbuf, int no_res
 
 /* 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 @@ static int _cluster_request(char cmd, const char *node, void *data, int len,
        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;
 
This page took 0.044686 seconds and 5 git commands to generate.