scsi: iscsi: iscsi_tcp: Start socket shutdown during conn stop
authorMike Christie <michael.christie@oracle.com>
Tue, 25 May 2021 18:18:02 +0000 (13:18 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 2 Jun 2021 05:28:20 +0000 (01:28 -0400)
Make sure the conn socket shutdown starts before we start the timer to fail
commands to upper layers.

Link: https://lore.kernel.org/r/20210525181821.7617-10-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/iscsi_tcp.c

index 553e95a..1bc3759 100644 (file)
@@ -600,6 +600,12 @@ static void iscsi_sw_tcp_release_conn(struct iscsi_conn *conn)
        if (!sock)
                return;
 
+       /*
+        * Make sure we start socket shutdown now in case userspace is up
+        * but delayed in releasing the socket.
+        */
+       kernel_sock_shutdown(sock, SHUT_RDWR);
+
        sock_hold(sock->sk);
        iscsi_sw_tcp_conn_restore_callbacks(conn);
        sock_put(sock->sk);