Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Oct 2014 09:12:09 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r272812 - in head/sys: cam/ctl dev/iscsi
Message-ID:  <201410090912.s999C9rb062915@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Thu Oct  9 09:12:08 2014
New Revision: 272812
URL: https://svnweb.freebsd.org/changeset/base/272812

Log:
  Make iSCSI connection close somewhat less aggressive.
  
  It allows to push out some final data from the send queue to the socket
  before its close.  In particular, it increases chances for logout response
  to be delivered to the initiator.

Modified:
  head/sys/cam/ctl/ctl_frontend_iscsi.c
  head/sys/dev/iscsi/icl.c
  head/sys/dev/iscsi/icl.h
  head/sys/dev/iscsi/iscsi.c

Modified: head/sys/cam/ctl/ctl_frontend_iscsi.c
==============================================================================
--- head/sys/cam/ctl/ctl_frontend_iscsi.c	Thu Oct  9 09:04:01 2014	(r272811)
+++ head/sys/cam/ctl/ctl_frontend_iscsi.c	Thu Oct  9 09:12:08 2014	(r272812)
@@ -1135,7 +1135,6 @@ cfiscsi_maintenance_thread(void *arg)
 			 * that anymore.  We might need to revisit that.
 			 */
 			callout_drain(&cs->cs_callout);
-			icl_conn_shutdown(cs->cs_conn);
 			icl_conn_close(cs->cs_conn);
 
 			/*

Modified: head/sys/dev/iscsi/icl.c
==============================================================================
--- head/sys/dev/iscsi/icl.c	Thu Oct  9 09:04:01 2014	(r272811)
+++ head/sys/dev/iscsi/icl.c	Thu Oct  9 09:12:08 2014	(r272812)
@@ -873,8 +873,6 @@ icl_conn_send_pdus(struct icl_conn *ic, 
 	SOCKBUF_UNLOCK(&so->so_snd);
 
 	while (!STAILQ_EMPTY(queue)) {
-		if (ic->ic_disconnecting)
-			return;
 		request = STAILQ_FIRST(queue);
 		size = icl_pdu_size(request);
 		if (available < size) {
@@ -971,11 +969,6 @@ icl_send_thread(void *arg)
 	ic->ic_send_running = true;
 
 	for (;;) {
-		if (ic->ic_disconnecting) {
-			//ICL_DEBUG("terminating");
-			break;
-		}
-
 		for (;;) {
 			/*
 			 * If the local queue is empty, populate it from
@@ -1014,6 +1007,11 @@ icl_send_thread(void *arg)
 			break;
 		}
 
+		if (ic->ic_disconnecting) {
+			//ICL_DEBUG("terminating");
+			break;
+		}
+
 		cv_wait(&ic->ic_send_cv, ic->ic_lock);
 	}
 
@@ -1298,21 +1296,6 @@ icl_conn_handoff(struct icl_conn *ic, in
 }
 
 void
-icl_conn_shutdown(struct icl_conn *ic)
-{
-	ICL_CONN_LOCK_ASSERT_NOT(ic);
-
-	ICL_CONN_LOCK(ic);
-	if (ic->ic_socket == NULL) {
-		ICL_CONN_UNLOCK(ic);
-		return;
-	}
-	ICL_CONN_UNLOCK(ic);
-
-	soshutdown(ic->ic_socket, SHUT_RDWR);
-}
-
-void
 icl_conn_close(struct icl_conn *ic)
 {
 	struct icl_pdu *pdu;

Modified: head/sys/dev/iscsi/icl.h
==============================================================================
--- head/sys/dev/iscsi/icl.h	Thu Oct  9 09:04:01 2014	(r272811)
+++ head/sys/dev/iscsi/icl.h	Thu Oct  9 09:12:08 2014	(r272812)
@@ -107,7 +107,6 @@ struct icl_conn {
 struct icl_conn		*icl_conn_new(const char *name, struct mtx *lock);
 void			icl_conn_free(struct icl_conn *ic);
 int			icl_conn_handoff(struct icl_conn *ic, int fd);
-void			icl_conn_shutdown(struct icl_conn *ic);
 void			icl_conn_close(struct icl_conn *ic);
 bool			icl_conn_connected(struct icl_conn *ic);
 

Modified: head/sys/dev/iscsi/iscsi.c
==============================================================================
--- head/sys/dev/iscsi/iscsi.c	Thu Oct  9 09:04:01 2014	(r272811)
+++ head/sys/dev/iscsi/iscsi.c	Thu Oct  9 09:12:08 2014	(r272812)
@@ -367,7 +367,6 @@ static void
 iscsi_maintenance_thread_reconnect(struct iscsi_session *is)
 {
 
-	icl_conn_shutdown(is->is_conn);
 	icl_conn_close(is->is_conn);
 
 	ISCSI_SESSION_LOCK(is);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201410090912.s999C9rb062915>