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

Mike Christie michaelc at cs.wisc.edu
Mon May 2 18:56:37 UTC 2011


The following commit has been merged in the upstream-mnc branch:
commit 6a9fc9ff0f49eac37da86847268dda437609f1d4
Author: Mike Christie <michaelc at cs.wisc.edu>
Date:   Mon Feb 14 16:42:11 2011 -0600

    iscsiadm: fix discovery exit code
    
    If we cannot connect to iscsid to get the initiatorname
    then we should propoate the error upwards instead of
    converting to INVAL or dropping.

diff --git a/usr/discovery.c b/usr/discovery.c
index 742334f..3c49aff 100644
--- a/usr/discovery.c
+++ b/usr/discovery.c
@@ -80,7 +80,7 @@ static int request_initiator_name(void)
 
 	rc = iscsid_exec_req(&req, &rsp, 1);
 	if (rc)
-		return EIO;
+		return rc;
 
 	if (rsp.u.config.var[0] != '\0')
 		strcpy(initiator_name, rsp.u.config.var);
@@ -344,11 +344,17 @@ int discovery_isns(void *data, struct iface_rec *iface,
 	if (iface && strlen(iface->iname))
 		iname = iface->iname;
 	else {
-		if (request_initiator_name() || initiator_name[0] == '\0') {
+		rc = request_initiator_name();
+		if (rc) {
 			log_error("Cannot perform discovery. Initiatorname "
 				  "required.");
+			return rc;
+		} else if (initiator_name[0] == '\0') {
+			log_error("Cannot perform discovery. Invalid "
+				  "Initiatorname.");
 			return ISCSI_ERR_INVAL;
 		}
+
 		iname = initiator_name;
 	}
 
@@ -838,15 +844,18 @@ iscsi_alloc_session(struct iscsi_sendtargets_config *config,
 	session->isid[4] = 0;
 	session->isid[5] = 0;
 
-	request_initiator_name();
-
 	if (iface && strlen(iface->iname)) {
 		strcpy(initiator_name, iface->iname);
 		/* MNC TODO add iface alias */
 	} else {
-		if (initiator_name[0] == '\0') {
+		*rc = request_initiator_name();
+		if (*rc) {
 			log_error("Cannot perform discovery. Initiatorname "
 				  "required.");
+			goto fail;
+		} else if (initiator_name[0] == '\0') {
+			log_error("Cannot perform discovery. Invalid "
+				  "Initiatorname.");
 			*rc = ISCSI_ERR_INVAL;
 			goto fail;
 		}

-- 
Debian Open-iSCSI Packaging



More information about the Pkg-iscsi-maintainers mailing list