master - lvmlockd: fix sending debug info to lvmlockctl
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1fae121b222927584a7a88cd3f4f1ba2aadb4931 Commit: 1fae121b222927584a7a88cd3f4f1ba2aadb4931 Parent: 180f92d3dc9891d4536a69de25dcb285979cd9e4 Author: David Teigland <[email protected]> AuthorDate: Thu Aug 20 14:00:12 2015 -0500 Committer: David Teigland <[email protected]> CommitterDate: Thu Aug 20 14:07:11 2015 -0500
lvmlockd: fix sending debug info to lvmlockctl
Single messages sent over unix sockets are limited in size to /proc/sys/net/core/wmem_max, so send the 1MB debug buffer in smaller chunks to avoid EMSGSIZE.
Also look for EAGAIN and retry sending for a limited time when the reader is slower than the writer.
Also shift the location of that code so it's the same as other requests.
--- daemons/lvmlockd/lvmlockctl.c | 9 +++- daemons/lvmlockd/lvmlockd-core.c | 114 ++++++++++++++++++++++++++------------ 2 files changed, 86 insertions(+), 37 deletions(-)
daemons/lvmlockd/lvmlockctl.c +8 -1
@@ -379,6 +379,7 @@ static int setup_dump_socket(void) rv =bind (s, (struct sockaddr *) &dump_addr, dump_addrlen);if (rv <0 ) { + rv = -errno;if (!close (s))log_error ("failed to close dump socket" );return rv;
@@ -392,6 +393,7 @@ static int do_dump(const char *req_name)daemon_reply reply;int result;int fd, rv =0 ; +int count =0 ; fd =setup_dump_socket ();if (fd <0 ) {
@@ -422,13 +424,18 @@ static int do_dump(const char *req_name)memset (dump_buf,0 ,sizeof (dump_buf)); - rv =recvfrom (fd, dump_buf, dump_len,MSG_WAITALL , +retry: + rv =recvfrom (fd, dump_buf + count, dump_len - count,MSG_WAITALL , (struct sockaddr *)&dump_addr, &dump_addrlen);if (rv <0 ) {log_error ("recvfrom error %d %d" , rv, errno); rv = -errno; goto out; } + count += rv; + +if (count < dump_len) + goto retry; rv =0 ;if ((info && dump) || !strcmp (req_name,"dump" ))
daemons/lvmlockd/lvmlockd-core.c +78 -36
182 lines not on this page · raw message