[iscsi-initiator-utils: 106/109] fix iscsiuio socket activation

Chris Leech cleech at fedoraproject.org
Tue Dec 10 21:28:13 UTC 2013


commit a47be9a29bdce6c56bf344a45fbe5a93d08378a8
Author: Chris Leech <cleech at redhat.com>
Date:   Mon Nov 25 21:20:51 2013 -0800

    fix iscsiuio socket activation
    
    Resolves: #1028446

 ...scsiuio-systemd-socket-activation-support.patch |   58 ++++++++++++++++++++
 iscsi-initiator-utils.spec                         |    7 ++-
 2 files changed, 64 insertions(+), 1 deletions(-)
---
diff --git a/0047-iscsiuio-systemd-socket-activation-support.patch b/0047-iscsiuio-systemd-socket-activation-support.patch
new file mode 100644
index 0000000..896eba9
--- /dev/null
+++ b/0047-iscsiuio-systemd-socket-activation-support.patch
@@ -0,0 +1,58 @@
+From 8003178db245b43d04b27b559d5541ced24ec13f Mon Sep 17 00:00:00 2001
+From: Chris Leech <cleech at redhat.com>
+Date: Wed, 19 Dec 2012 21:39:06 -0800
+Subject: [PATCH] iscsiuio systemd socket activation support
+
+---
+ iscsiuio/src/unix/iscsid_ipc.c | 28 ++++++++++++++++++++++++++++
+ 1 file changed, 28 insertions(+)
+
+diff --git a/iscsiuio/src/unix/iscsid_ipc.c b/iscsiuio/src/unix/iscsid_ipc.c
+index e22de0d..4908cb7 100644
+--- a/iscsiuio/src/unix/iscsid_ipc.c
++++ b/iscsiuio/src/unix/iscsid_ipc.c
+@@ -948,6 +948,30 @@ static void *iscsid_loop(void *arg)
+ 	pthread_exit(NULL);
+ }
+ 
++#define SD_SOCKET_FDS_START 3
++
++static int ipc_systemd(void)
++{
++	char *env;
++
++	env = getenv("LISTEN_PID");
++
++	if (!env || (strtoul(env, NULL, 10) != getpid()))
++		return -EINVAL;
++
++	env = getenv("LISTEN_FDS");
++
++	if (!env)
++		return -EINVAL;
++
++	if (strtoul(env, NULL, 10) != 1) {
++		LOG_ERR("Did not receive exactly one IPC socket from systemd");
++		return -EINVAL;
++	}
++
++	return SD_SOCKET_FDS_START;
++}
++
+ /******************************************************************************
+  *  Initialize/Cleanup routines
+  ******************************************************************************/
+@@ -961,6 +985,10 @@ int iscsid_init()
+ 	int rc, addr_len;
+ 	struct sockaddr_un addr;
+ 
++	iscsid_opts.fd = ipc_systemd();
++	if (iscsid_opts.fd >= 0)
++		return 0;
++
+ 	iscsid_opts.fd = socket(AF_LOCAL, SOCK_STREAM, 0);
+ 	if (iscsid_opts.fd < 0) {
+ 		LOG_ERR(PFX "Can not create IPC socket");
+-- 
+1.8.3.1
+
diff --git a/iscsi-initiator-utils.spec b/iscsi-initiator-utils.spec
index d49858c..4c925e4 100644
--- a/iscsi-initiator-utils.spec
+++ b/iscsi-initiator-utils.spec
@@ -4,7 +4,7 @@
 Summary: iSCSI daemon and utility programs
 Name: iscsi-initiator-utils
 Version: 6.%{open_iscsi_version}.%{open_iscsi_build}
-Release: 15%{?dist}
+Release: 16%{?dist}
 Group: System Environment/Daemons
 License: GPLv2+
 URL: http://www.open-iscsi.org
@@ -48,6 +48,7 @@ Patch42: 0042-ISCSID-Added-iface-content-override-fix.patch
 Patch43: 0043-idmb_rec_write-check-for-tpgt-first.patch
 Patch45: 0045-idbm_rec_write-seperate-old-and-new-style-writes.patch
 Patch46: 0046-idbw_rec_write-pick-tpgt-from-existing-record.patch
+Patch47: 0047-iscsiuio-systemd-socket-activation-support.patch
 Patch49: 0049-update-systemd-service-files-add-iscsi.service-for-s.patch
 Patch50: 0050-iscsi-boot-related-service-file-updates.patch
 # distro specific modifications
@@ -128,6 +129,7 @@ developing applications that use %{name}.
 %patch43 -p1
 %patch45 -p1
 %patch46 -p1
+%patch47 -p1
 %patch49 -p1
 %patch50 -p1
 # distro specific modifications
@@ -293,6 +295,9 @@ fi
 %{_includedir}/libiscsi.h
 
 %changelog
+* Mon Nov 25 2013 Chris Leech <cleech at redhat.com> - 6.2.0.873-16
+- fix iscsiuio socket activation
+
 * Sun Sep 15 2013 Chris Leech <cleech at redhat.com> - 6.2.0.873-15
 - move /sbin to /usr/sbin
 - use rpm macros in install rules


More information about the scm-commits mailing list