svn commit: r265510 - stable/10/sys/cam/ctl

Edward Tomasz Napierala trasz at FreeBSD.org
Wed May 7 07:33:57 UTC 2014


Author: trasz
Date: Wed May  7 07:33:56 2014
New Revision: 265510
URL: http://svnweb.freebsd.org/changeset/base/265510

Log:
  MFC r264527:
  
  Make it possible to interrupt login when running in proxy mode.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c	Wed May  7 07:32:45 2014	(r265509)
+++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c	Wed May  7 07:33:56 2014	(r265510)
@@ -1130,6 +1130,9 @@ cfiscsi_session_terminate(struct cfiscsi
 		return;
 	cs->cs_terminating = 1;
 	cv_signal(&cs->cs_maintenance_cv);
+#ifdef ICL_KERNEL_PROXY
+	cv_signal(&cs->cs_login_cv);
+#endif
 }
 
 static int
@@ -1864,6 +1867,7 @@ cfiscsi_ioctl_receive(struct ctl_iscsi *
 	struct cfiscsi_session *cs;
 	struct icl_pdu *ip;
 	void *data;
+	int error;
 
 	cirp = (struct ctl_iscsi_receive_params *)&(ci->data);
 
@@ -1874,7 +1878,8 @@ cfiscsi_ioctl_receive(struct ctl_iscsi *
 	}
 	if (cs == NULL) {
 		mtx_unlock(&cfiscsi_softc.lock);
-		snprintf(ci->error_str, sizeof(ci->error_str), "connection not found");
+		snprintf(ci->error_str, sizeof(ci->error_str),
+		    "connection not found");
 		ci->status = CTL_ISCSI_ERROR;
 		return;
 	}
@@ -1886,12 +1891,21 @@ cfiscsi_ioctl_receive(struct ctl_iscsi *
 #endif
 
 	CFISCSI_SESSION_LOCK(cs);
-	while (cs->cs_login_pdu == NULL &&
-	    cs->cs_terminating == false)
-		cv_wait(&cs->cs_login_cv, &cs->cs_lock);
+	while (cs->cs_login_pdu == NULL && cs->cs_terminating == false) {
+		error = cv_wait_sig(&cs->cs_login_cv, &cs->cs_lock);
+		if (error != 0) {
+			CFISCSI_SESSION_UNLOCK(cs);
+			snprintf(ci->error_str, sizeof(ci->error_str),
+			    "interrupted by signal");
+			ci->status = CTL_ISCSI_ERROR;
+			return;
+		}
+	}
+
 	if (cs->cs_terminating) {
 		CFISCSI_SESSION_UNLOCK(cs);
-		snprintf(ci->error_str, sizeof(ci->error_str), "connection terminating");
+		snprintf(ci->error_str, sizeof(ci->error_str),
+		    "connection terminating");
 		ci->status = CTL_ISCSI_ERROR;
 		return;
 	}
@@ -1901,7 +1915,8 @@ cfiscsi_ioctl_receive(struct ctl_iscsi *
 
 	if (ip->ip_data_len > cirp->data_segment_len) {
 		icl_pdu_free(ip);
-		snprintf(ci->error_str, sizeof(ci->error_str), "data segment too big");
+		snprintf(ci->error_str, sizeof(ci->error_str),
+		    "data segment too big");
 		ci->status = CTL_ISCSI_ERROR;
 		return;
 	}


More information about the svn-src-all mailing list