Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/dev/iscsi Don't resume throttled CCBs when connection is...



details:   https://anonhg.NetBSD.org/src/rev/313644bfe8f4
branches:  trunk
changeset: 345717:313644bfe8f4
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Sun Jun 05 14:00:12 2016 +0000

description:
Don't resume throttled CCBs when connection is terminating, except for
those being actively waited for. Stop unthrottling when reaching MaxCmdSN
again.

diffstat:

 sys/dev/iscsi/iscsi_rcv.c |  32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)

diffs (64 lines):

diff -r 937efa7e7874 -r 313644bfe8f4 sys/dev/iscsi/iscsi_rcv.c
--- a/sys/dev/iscsi/iscsi_rcv.c Sun Jun 05 13:54:28 2016 +0000
+++ b/sys/dev/iscsi/iscsi_rcv.c Sun Jun 05 14:00:12 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: iscsi_rcv.c,v 1.19 2016/06/05 11:01:39 mlelstv Exp $   */
+/*     $NetBSD: iscsi_rcv.c,v 1.20 2016/06/05 14:00:12 mlelstv Exp $   */
 
 /*-
  * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc.
@@ -1148,6 +1148,7 @@
 
        if (sn_a_lt_b(sess->MaxCmdSN, MaxCmdSN)) {
                sess->MaxCmdSN = MaxCmdSN;
+
                if (TAILQ_FIRST(&sess->ccbs_throttled) == NULL) {
                        mutex_exit(&sess->lock);
                        return 0;
@@ -1157,24 +1158,39 @@
 
                TAILQ_INIT(&waiting);
                while ((req_ccb = TAILQ_FIRST(&sess->ccbs_throttled)) != NULL) {
-                       throttle_ccb(req_ccb, FALSE);
-                       TAILQ_INSERT_TAIL(&waiting, req_ccb, chain);
+                       if (!conn->terminating ||
+                           (req_ccb->flags & CCBF_WAITING) != 0) {
+                               throttle_ccb(req_ccb, FALSE);
+                               TAILQ_INSERT_TAIL(&waiting, req_ccb, chain);
+                       }
                }
-               mutex_exit(&sess->lock);
 
                while ((req_ccb = TAILQ_FIRST(&waiting)) != NULL) {
+                       if (!sernum_in_window(sess))
+                               break;
+                       mutex_exit(&sess->lock);
+
                        TAILQ_REMOVE(&waiting, req_ccb, chain);
 
                        DEBC(conn, 10, ("Unthrottling - ccb = %p, disp = %d\n",
                                        req_ccb, req_ccb->disp));
 
-                       if (req_ccb->flags & CCBF_WAITING) {
+                       if ((req_ccb->flags & CCBF_WAITING) != 0) {
                                cv_broadcast(&conn->ccb_cv);
-                       } else
+                       } else {
                                send_command(req_ccb, req_ccb->disp, FALSE, FALSE);
+                       }
+
+                       mutex_enter(&sess->lock);
                }
-       } else
-               mutex_exit(&sess->lock);
+
+               while ((req_ccb = TAILQ_FIRST(&waiting)) != NULL) {
+                       TAILQ_REMOVE(&waiting, req_ccb, chain);
+                       throttle_ccb(req_ccb, TRUE);
+               }
+       }
+
+       mutex_exit(&sess->lock);
 
        return 0;
 }



Home | Main Index | Thread Index | Old Index