]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
scsi: libiscsi: Reset max/exp cmdsn during recovery
authorMike Christie <michael.christie@oracle.com>
Sun, 7 Feb 2021 04:46:06 +0000 (22:46 -0600)
committerMartin K. Petersen <martin.petersen@oracle.com>
Tue, 9 Feb 2021 03:39:04 +0000 (22:39 -0500)
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 window values during session cleanup so they
can be updated after a new login.

Link: https://lore.kernel.org/r/20210207044608.27585-8-michael.christie@oracle.com
Reviewed-by: Lee Duncan <lduncan@suse.com>
Signed-off-by: Mike Christie <michael.christie@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/libiscsi.c

index f64e2077754cd0881fe96484f4a1d0fa6cc7432c..7ad11e42306dedd4b935d2b2c326f3d87c278e9d 100644 (file)
@@ -3273,6 +3273,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.
         */