Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Apr 2014 19:59:06 +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: r264552 - head/sys/dev/iscsi
Message-ID:  <201404161959.s3GJx6A8009487@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Apr 16 19:59:06 2014
New Revision: 264552
URL: http://svnweb.freebsd.org/changeset/base/264552

Log:
  Close the race in older code, that caused connection stuck after r264348.
  
  Reviewed by:	trasz
  MFC after:	2 weeks
  Sponsored by:	iXsystems, Inc.

Modified:
  head/sys/dev/iscsi/icl.c

Modified: head/sys/dev/iscsi/icl.c
==============================================================================
--- head/sys/dev/iscsi/icl.c	Wed Apr 16 19:49:44 2014	(r264551)
+++ head/sys/dev/iscsi/icl.c	Wed Apr 16 19:59:06 2014	(r264552)
@@ -877,11 +877,6 @@ icl_conn_send_pdus(struct icl_conn *ic, 
 		request = STAILQ_FIRST(queue);
 		size = icl_pdu_size(request);
 		if (available < size) {
-#if 1
-			ICL_DEBUG("no space to send; "
-			    "have %zd, need %zd",
-			    available, size);
-#endif
 
 			/*
 			 * Set the low watermark, to be checked by
@@ -890,9 +885,18 @@ icl_conn_send_pdus(struct icl_conn *ic, 
 			 * is enough space for the PDU to fit.
 			 */
 			SOCKBUF_LOCK(&so->so_snd);
-			so->so_snd.sb_lowat = size;
+			available = sbspace(&so->so_snd);
+			if (available < size) {
+#if 1
+				ICL_DEBUG("no space to send; "
+				    "have %zd, need %zd",
+				    available, size);
+#endif
+				so->so_snd.sb_lowat = size;
+				SOCKBUF_UNLOCK(&so->so_snd);
+				return;
+			}
 			SOCKBUF_UNLOCK(&so->so_snd);
-			return;
 		}
 		STAILQ_REMOVE_HEAD(queue, ip_next);
 		error = icl_pdu_finalize(request);



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