mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
Cope with more than one message arriving at the TCP socket, also
fix some instances where the length in the message was wrong (cman code didn't notice this because it is packet-based comms anyway)
This commit is contained in:
parent
65c591696a
commit
c9808c329d
@ -1,6 +1,7 @@
|
|||||||
Version 2.01.05 -
|
Version 2.01.05 -
|
||||||
===================================
|
===================================
|
||||||
Make clvmd config check a little more tolerant.
|
Make clvmd config check a little more tolerant.
|
||||||
|
gulm clvmd can now cope with >1 message arriving in a TCP message.
|
||||||
|
|
||||||
Version 2.01.04 - 9th February 2005
|
Version 2.01.04 - 9th February 2005
|
||||||
===================================
|
===================================
|
||||||
|
@ -1190,9 +1190,8 @@ void process_remote_command(struct clvm_header *msg, int msglen, int fd,
|
|||||||
|
|
||||||
/* If System LV operation failed then report it as EFBIG but only do it
|
/* If System LV operation failed then report it as EFBIG but only do it
|
||||||
if the data buffer has something in it. */
|
if the data buffer has something in it. */
|
||||||
if (system_lv_write_data
|
if (system_lv_write_data(aggreply,
|
||||||
(aggreply,
|
replylen + sizeof(struct clvm_header)) < 0
|
||||||
replylen + sizeof(struct clvm_header)) < 0
|
|
||||||
&& replylen > 0)
|
&& replylen > 0)
|
||||||
agghead->status = EFBIG;
|
agghead->status = EFBIG;
|
||||||
|
|
||||||
@ -1210,7 +1209,7 @@ void process_remote_command(struct clvm_header *msg, int msglen, int fd,
|
|||||||
agghead->node[0] = '\0';
|
agghead->node[0] = '\0';
|
||||||
send_message(aggreply,
|
send_message(aggreply,
|
||||||
sizeof(struct clvm_header) +
|
sizeof(struct clvm_header) +
|
||||||
replylen + 2, csid, fd,
|
replylen, csid, fd,
|
||||||
"Error sending command reply");
|
"Error sending command reply");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1532,6 +1531,7 @@ static void send_version_message()
|
|||||||
version_nums[1] = htonl(CLVMD_MINOR_VERSION);
|
version_nums[1] = htonl(CLVMD_MINOR_VERSION);
|
||||||
version_nums[2] = htonl(CLVMD_PATCH_VERSION);
|
version_nums[2] = htonl(CLVMD_PATCH_VERSION);
|
||||||
|
|
||||||
|
hton_clvm(msg);
|
||||||
clops->cluster_send_message(message, sizeof(message), NULL,
|
clops->cluster_send_message(message, sizeof(message), NULL,
|
||||||
"Error Sending version number");
|
"Error Sending version number");
|
||||||
}
|
}
|
||||||
@ -1544,7 +1544,7 @@ static int send_message(void *buf, int msglen, char *csid, int fd,
|
|||||||
|
|
||||||
/* Send remote messages down the cluster socket */
|
/* Send remote messages down the cluster socket */
|
||||||
if (csid == NULL || !ISLOCAL_CSID(csid)) {
|
if (csid == NULL || !ISLOCAL_CSID(csid)) {
|
||||||
hton_clvm((struct clvm_header *) buf); /* Byte swap if necessary */
|
hton_clvm((struct clvm_header *) buf);
|
||||||
return clops->cluster_send_message(buf, msglen, csid, errtext);
|
return clops->cluster_send_message(buf, msglen, csid, errtext);
|
||||||
} else {
|
} else {
|
||||||
int ptr = 0;
|
int ptr = 0;
|
||||||
|
@ -227,7 +227,9 @@ static int read_from_tcpsock(struct local_client *client, char *buf, int len, ch
|
|||||||
{
|
{
|
||||||
struct sockaddr_in6 addr;
|
struct sockaddr_in6 addr;
|
||||||
socklen_t slen = sizeof(addr);
|
socklen_t slen = sizeof(addr);
|
||||||
|
struct clvm_header *header = (struct clvm_header *)buf;
|
||||||
int status;
|
int status;
|
||||||
|
uint32_t arglen;
|
||||||
|
|
||||||
DEBUGLOG("read_from_tcpsock fd %d\n", client->fd);
|
DEBUGLOG("read_from_tcpsock fd %d\n", client->fd);
|
||||||
*new_client = NULL;
|
*new_client = NULL;
|
||||||
@ -236,7 +238,26 @@ static int read_from_tcpsock(struct local_client *client, char *buf, int len, ch
|
|||||||
getpeername(client->fd, (struct sockaddr *)&addr, &slen);
|
getpeername(client->fd, (struct sockaddr *)&addr, &slen);
|
||||||
memcpy(csid, &addr.sin6_addr, GULM_MAX_CSID_LEN);
|
memcpy(csid, &addr.sin6_addr, GULM_MAX_CSID_LEN);
|
||||||
|
|
||||||
status = read(client->fd, buf, len);
|
/* Read just the header first, then get the rest if there is any.
|
||||||
|
* Stream sockets, sigh.
|
||||||
|
*/
|
||||||
|
status = read(client->fd, buf, sizeof(struct clvm_header));
|
||||||
|
if (status > 0)
|
||||||
|
{
|
||||||
|
int status2;
|
||||||
|
|
||||||
|
arglen = ntohl(header->arglen);
|
||||||
|
|
||||||
|
/* Get the rest */
|
||||||
|
if (arglen && arglen < GULM_MAX_CLUSTER_MESSAGE)
|
||||||
|
{
|
||||||
|
status2 = read(client->fd, buf+status, arglen);
|
||||||
|
if (status2 > 0)
|
||||||
|
status += status2;
|
||||||
|
else
|
||||||
|
status = status2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEBUGLOG("read_from_tcpsock, status = %d(errno = %d)\n", status, errno);
|
DEBUGLOG("read_from_tcpsock, status = %d(errno = %d)\n", status, errno);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user