All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michael.christie@oracle.com>
To: lduncan@suse.com, cleech@redhat.com, martin.petersen@oracle.com,
	linux-scsi@vger.kernel.org,
	james.bottomley@hansenpartnership.com
Cc: lutianxiong@huawei.com, linfeilong@huawei.com,
	liuzhiqiang26@huawei.com, haowenchao@huawei.com
Subject: [PATCH 7/7] libiscsi: reset max/exp cmdsn during recovery
Date: Mon, 18 Jan 2021 14:34:30 -0600	[thread overview]
Message-ID: <20210118203430.4921-8-michael.christie@oracle.com> (raw)
In-Reply-To: <20210118203430.4921-1-michael.christie@oracle.com>

If we lose the session then relogin, but the new cmdsn window has
shrunk (due to something like an admin changing a setting) we will
have the old exp/max_cmdsn values and will never be able to update
them. For example, max_cmdsn would be 64, but if on the target the
user set the window to be smaller then the target could try to return
the max_cmdsn as 32. We will see that new max_cmdsn in the rsp but
because it's lower than the old max_cmdsn when the window was larger
we will not update it.

So this patch has us reset the windown values during session
cleanup so they can be updated after a new login.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
Reviewed-by: Lee Duncan <lduncan@suse.com>
---
 drivers/scsi/libiscsi.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index 195006a08e0d..be29837372c2 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -3271,6 +3271,13 @@ int iscsi_conn_bind(struct iscsi_cls_session *cls_session,
 		session->leadconn = conn;
 	spin_unlock_bh(&session->frwd_lock);
 
+	/*
+	 * The target could have reduced it's window size between logins, so
+	 * we have to reset max/exp cmdsn so we can see the new values.
+	 */
+	spin_lock_bh(&session->back_lock);
+	session->max_cmdsn = session->exp_cmdsn = session->cmdsn + 1;
+	spin_unlock_bh(&session->back_lock);
 	/*
 	 * Unblock xmitworker(), Login Phase will pass through.
 	 */
-- 
2.25.1


      parent reply	other threads:[~2021-01-18 20:36 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-18 20:34 [PATCH 0/7] iscsi fixes/cleanups Mike Christie
2021-01-18 20:34 ` [PATCH 1/7] libiscsi: fix iscsi_prep_scsi_cmd_pdu error handling Mike Christie
2021-01-18 20:34 ` [PATCH 2/7] libiscsi: drop taskqueuelock Mike Christie
2021-01-27 22:30   ` Lee Duncan
2021-01-18 20:34 ` [PATCH 3/7] libiscsi: fix iscsi_task use after free Mike Christie
2021-01-18 20:34 ` [PATCH 4/7] libiscsi: fix iscsi host workq destruction Mike Christie
2021-01-27 18:09   ` Lee Duncan
2021-01-18 20:34 ` [PATCH 5/7] libiscsi: add helper to calc max scsi cmds per session Mike Christie
2021-01-27 19:45   ` Lee Duncan
2021-01-28  0:55     ` michael.christie
2021-01-18 20:34 ` [PATCH 6/7] iscsi_tcp: fix shost can_queue initialization Mike Christie
2021-01-27 19:47   ` Lee Duncan
2021-01-18 20:34 ` Mike Christie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210118203430.4921-8-michael.christie@oracle.com \
    --to=michael.christie@oracle.com \
    --cc=cleech@redhat.com \
    --cc=haowenchao@huawei.com \
    --cc=james.bottomley@hansenpartnership.com \
    --cc=lduncan@suse.com \
    --cc=linfeilong@huawei.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=liuzhiqiang26@huawei.com \
    --cc=lutianxiong@huawei.com \
    --cc=martin.petersen@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.