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);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to