summaryrefslogtreecommitdiffstats
path: root/daemons/clvmd/clvmd.c
diff options
context:
space:
mode:
authorMilan Broz <mbroz@redhat.com>2011-08-11 12:57:10 +0000
committerMilan Broz <mbroz@redhat.com>2011-08-11 12:57:10 +0000
commitfc438d74b7a9341682a4b5841dc0186629e61ac1 (patch)
tree2ac4f13f0183ead1c01af34c478a2b699bb71ce0 /daemons/clvmd/clvmd.c
parent3041b72f063a3deaaa76c581405ae5a0fb6193a6 (diff)
downloadlvm2-fc438d74b7a9341682a4b5841dc0186629e61ac1.tar.gz
lvm2-fc438d74b7a9341682a4b5841dc0186629e61ac1.tar.xz
lvm2-fc438d74b7a9341682a4b5841dc0186629e61ac1.zip
Never ever use uninitialised descriptors if pipe() fails
(because of maximum open count fd exceeded or so). Better return busy message, so even clients fail in more controlled way. Without patch, clvmd crashes with various strange backtraces if under heavy load of connection requests. https://bugzilla.redhat.com/show_bug.cgi?id=698393 https://bugzilla.redhat.com/show_bug.cgi?id=697945 (It still can OOM but that's different issue.)
Diffstat (limited to 'daemons/clvmd/clvmd.c')
-rw-r--r--daemons/clvmd/clvmd.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/daemons/clvmd/clvmd.c b/daemons/clvmd/clvmd.c
index 07883eaa..cffb7456 100644
--- a/daemons/clvmd/clvmd.c
+++ b/daemons/clvmd/clvmd.c
@@ -1263,9 +1263,19 @@ static int read_from_local_sock(struct local_client *thisfd)
}
/* Create a pipe and add the reading end to our FD list */
- if (pipe(comms_pipe))
+ if (pipe(comms_pipe)) {
+ struct clvm_header reply;
DEBUGLOG("creating pipe failed: %s\n", strerror(errno));
-
+ reply.cmd = CLVMD_CMD_REPLY;
+ reply.status = EBUSY;
+ reply.arglen = 0;
+ reply.flags = 0;
+ send_message(&reply, sizeof(reply), our_csid,
+ thisfd->fd,
+ "Error sending EBUSY reply to local user");
+ return len;
+ }
+
newfd = malloc(sizeof(struct local_client));
if (!newfd) {
struct clvm_header reply;