public inbox for lvm2-cvs@sourceware.org
help / color / mirror / Atom feed
From: snitzer@sourceware.org
To: lvm-devel@redhat.com, lvm2-cvs@sourceware.org
Subject: LVM2 ./WHATS_NEW daemons/clvmd/clvmd-singlenode.c
Date: Fri, 26 Mar 2010 15:45:00 -0000	[thread overview]
Message-ID: <20100326154537.2860.qmail@sourceware.org> (raw)

CVSROOT:	/cvs/lvm2
Module name:	LVM2
Changes by:	snitzer@sourceware.org	2010-03-26 15:45:37

Modified files:
	.              : WHATS_NEW 
	daemons/clvmd  : clvmd-singlenode.c 

Log message:
	Use a real socket for singlenode clvmd to fix clvmd's high cpu load.

Patches:
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/WHATS_NEW.diff?cvsroot=lvm2&r1=1.1483&r2=1.1484
http://sourceware.org/cgi-bin/cvsweb.cgi/LVM2/daemons/clvmd/clvmd-singlenode.c.diff?cvsroot=lvm2&r1=1.1&r2=1.2

--- LVM2/WHATS_NEW	2010/03/26 15:40:13	1.1483
+++ LVM2/WHATS_NEW	2010/03/26 15:45:36	1.1484
@@ -1,5 +1,6 @@
 Version 2.02.63 -  
 ================================
+  Use a real socket for singlenode clvmd to fix clvmd's high cpu load.
   Fix clvmd cluster propagation of dmeventd monitoring mode.
   Allow ALLOC_ANYWHERE to split contiguous areas.
   Use INTERNAL_ERROR for internal errors throughout tree.
--- LVM2/daemons/clvmd/clvmd-singlenode.c	2010/03/18 09:19:31	1.1
+++ LVM2/daemons/clvmd/clvmd-singlenode.c	2010/03/26 15:45:36	1.2
@@ -17,6 +17,7 @@
 
 #include <netinet/in.h>
 #include <sys/un.h>
+#include <sys/socket.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <configure.h>
@@ -31,18 +32,37 @@
 #include "lvm-functions.h"
 #include "clvmd.h"
 
+static const char SINGLENODE_CLVMD_SOCKNAME[] = "\0singlenode_clvmd";
 static int listen_fd = -1;
 
 static int init_comms()
 {
-	listen_fd = open("/dev/null", O_RDWR);
+	struct sockaddr_un addr;
 
-	if (listen_fd < 0)
+	listen_fd = socket(PF_UNIX, SOCK_STREAM, 0);
+	if (listen_fd < 0) {
+		DEBUGLOG("Can't create local socket: %s\n", strerror(errno));
 		return -1;
-
+	}
 	/* Set Close-on-exec */
 	fcntl(listen_fd, F_SETFD, 1);
 
+	memset(&addr, 0, sizeof(addr));
+	memcpy(addr.sun_path, SINGLENODE_CLVMD_SOCKNAME,
+	       sizeof(SINGLENODE_CLVMD_SOCKNAME));
+	addr.sun_family = AF_UNIX;
+
+	if (bind(listen_fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
+		DEBUGLOG("Can't bind local socket: %s\n", strerror(errno));
+		close(listen_fd);
+		return -1;
+	}
+	if (listen(listen_fd, 10) < 0) {
+		DEBUGLOG("Can't listen local socket: %s\n", strerror(errno));
+		close(listen_fd);
+		return -1;
+	}
+
 	return 0;
 }
 


             reply	other threads:[~2010-03-26 15:45 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-26 15:45 snitzer [this message]
2011-08-04 12:13 zkabelac
2011-10-11  9:05 zkabelac
2012-04-24 12:16 zkabelac

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100326154537.2860.qmail@sourceware.org \
    --to=snitzer@sourceware.org \
    --cc=lvm-devel@redhat.com \
    --cc=lvm2-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).