[Pkg-iscsi-maintainers] [SCM] Debian Open-iSCSI Packaging branch, upstream-mnc, updated. 2.0-872-193-gde2c0e7

Mike Christie michaelc at cs.wisc.edu
Sat Apr 7 15:44:10 UTC 2012


The following commit has been merged in the upstream-mnc branch:
commit c6b4ab8fdeb405501feb165ae9c90917f94d04f1
Author: Mike Christie <michaelc at cs.wisc.edu>
Date:   Sat Mar 10 04:10:45 2012 -0600

    iscsi tools: create def ifaces on demand
    
    This has iscsiadm/iscsid create the def ifaces when they are first
    read.

diff --git a/etc/initd/initd.redhat b/etc/initd/initd.redhat
index bb79b87..d149082 100644
--- a/etc/initd/initd.redhat
+++ b/etc/initd/initd.redhat
@@ -25,9 +25,6 @@ start()
 
 	touch /var/lock/subsys/open-iscsi
 
-	# load offload drivers and setup default ifaces if needed
-	iscsiadm -m iface 2>&1 > /dev/null
-
 	echo -n $"Setting up iSCSI targets: "
 	iscsiadm -m node --loginall=automatic
 	success
diff --git a/usr/iface.c b/usr/iface.c
index 3afa273..57ed774 100644
--- a/usr/iface.c
+++ b/usr/iface.c
@@ -169,7 +169,7 @@ free_conf:
 int iface_conf_read(struct iface_rec *iface)
 {
 	struct iface_rec *def_iface;
-	int rc;
+	int rc, retry = 0;
 
 	def_iface = iface_match_default(iface);
 	if (def_iface) {
@@ -197,12 +197,24 @@ int iface_conf_read(struct iface_rec *iface)
 		return 0;
 	}
 
+retry_read:
 	rc = idbm_lock();
 	if (rc)
 		return rc;
 
 	rc = __iface_conf_read(iface);
 	idbm_unlock();
+
+	/*
+	 * cmd was run before running -m iface, so force def bindings
+	 * creation to see if that was the one requested
+	 */
+	if (retry < 1 && rc == ISCSI_ERR_IDBM) {
+		iface_setup_host_bindings();
+		retry++;
+		goto retry_read;
+	}
+
 	return rc;
 }
 
@@ -449,6 +461,7 @@ static int iface_setup_binding_from_kern_iface(void *data,
 {
 	struct host_info *hinfo = data;
 	struct iface_rec iface;
+	char iface_path[PATH_MAX];
 
 	if (!strlen(hinfo->iface.hwaddress)) {
 		log_error("Invalid offload iSCSI host %u. Missing "
@@ -474,7 +487,11 @@ static int iface_setup_binding_from_kern_iface(void *data,
 			 hinfo->iface.transport_name, hinfo->iface.hwaddress);
 	}
 
-	if (iface_conf_read(&iface)) {
+	memset(iface_path, 0, sizeof(iface_path));
+	snprintf(iface_path, PATH_MAX, "%s/%s", IFACE_CONFIG_DIR,
+		 iface.name);
+
+	if (access(iface_path, F_OK) != 0) {
 		/* not found so create it */
 		if (iface_conf_write(&iface)) {
 			log_error("Could not create default iface conf %s.",

-- 
Debian Open-iSCSI Packaging



More information about the Pkg-iscsi-maintainers mailing list