diff options
| author | mlelstv <mlelstv@NetBSD.org> | 2016-06-05 05:07:23 +0000 |
|---|---|---|
| committer | mlelstv <mlelstv@NetBSD.org> | 2016-06-05 05:07:23 +0000 |
| commit | 90e17dfc0fb71371597e1bbd21dda72d6debc7a1 (patch) | |
| tree | 196cb1d066cb7213a1e31f1778db14be0cf0e084 /sys/dev | |
| parent | ddc644373ab14dd3fbdad957159a9eb93c678c82 (diff) | |
Fix serial number check and account for commands in flight to avoid
unnecessary recovery actions.
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/iscsi/iscsi_globals.h | 4 | ||||
| -rw-r--r-- | sys/dev/iscsi/iscsi_rcv.c | 21 |
2 files changed, 18 insertions, 7 deletions
diff --git a/sys/dev/iscsi/iscsi_globals.h b/sys/dev/iscsi/iscsi_globals.h index 51aab4c01bb..f1720498075 100644 --- a/sys/dev/iscsi/iscsi_globals.h +++ b/sys/dev/iscsi/iscsi_globals.h @@ -1,4 +1,4 @@ -/* $NetBSD: iscsi_globals.h,v 1.17 2016/06/05 04:48:17 mlelstv Exp $ */ +/* $NetBSD: iscsi_globals.h,v 1.18 2016/06/05 05:07:23 mlelstv Exp $ */ /*- * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc. @@ -81,7 +81,7 @@ effectively says "don't bother testing these values", and is used right now only in iscsi_send.c. */ #define ISCSI_THROTTLING_ENABLED 1 -#define ISCSI_SERVER_TRUSTED 1 +#define ISCSI_SERVER_TRUSTED 0 /* NOTE: CCBS_PER_SESSION must not exceed 256 due to the way the ITT diff --git a/sys/dev/iscsi/iscsi_rcv.c b/sys/dev/iscsi/iscsi_rcv.c index da8991920f5..4e98b0c632f 100644 --- a/sys/dev/iscsi/iscsi_rcv.c +++ b/sys/dev/iscsi/iscsi_rcv.c @@ -1,4 +1,4 @@ -/* $NetBSD: iscsi_rcv.c,v 1.14 2016/06/05 04:51:57 mlelstv Exp $ */ +/* $NetBSD: iscsi_rcv.c,v 1.15 2016/06/05 05:07:23 mlelstv Exp $ */ /*- * Copyright (c) 2004,2005,2006,2011 The NetBSD Foundation, Inc. @@ -376,7 +376,8 @@ check_CmdSN(connection_t *conn, uint32_t nw_sn) DEBC(conn, 10, ("CheckCmdSN - CmdSN=%d, ExpCmdSn=%d, waiting=%p, flags=%x\n", ccb->CmdSN, sn, ccb->pdu_waiting, ccb->flags)); - if (ccb->pdu_waiting != NULL && ccb->CmdSN > sn && + if (ccb->pdu_waiting != NULL && + sn_a_lt_b(sn, ccb->CmdSN) && !(ccb->flags & CCBF_GOT_RSP)) { DEBC(conn, 1, ("CheckCmdSN resending - CmdSN=%d, ExpCmdSn=%d\n", ccb->CmdSN, sn)); @@ -385,14 +386,24 @@ check_CmdSN(connection_t *conn, uint32_t nw_sn) if (++ccb->num_timeouts > MAX_CCB_TIMEOUTS || ccb->total_tries > MAX_CCB_TRIES) { - handle_connection_error(conn, ISCSI_STATUS_TIMEOUT, - (ccb->total_tries <= MAX_CCB_TRIES) ? RECOVER_CONNECTION - : LOGOUT_CONNECTION); + handle_connection_error(conn, + ISCSI_STATUS_TIMEOUT, + (ccb->total_tries <= MAX_CCB_TRIES) + ? RECOVER_CONNECTION + : LOGOUT_CONNECTION); break; } else { resend_pdu(ccb); } } + + /* + * The target can respond to a NOP-In before subsequent + * commands are processed. So our CmdSN can exceed the + * returned ExpCmdSN by the number of commands that are + * in flight. Adjust the expected value accordingly. + */ + sn++; } } |
