diff mbox series

[v3,5/6] scsi: iscsi_tcp: set no linger

Message ID 20210424221755.124438-6-michael.christie@oracle.com
State Superseded
Headers show
Series iscsi: Fix in kernel conn failure handling | expand

Commit Message

Mike Christie April 24, 2021, 10:17 p.m. UTC
Userspace (open-iscsi based tools at least) sets no linger on the socket
to prevent stale data from being sent. However, with the in kernel cleanup
if userspace is not up the sockfd_put will release the socket without
having set that sockopt.

iscsid sets that opt at socket close time, but it seems ok to set this at
setup time in the kernel for all tools. And, if we are only doing the in
kernel cleanup initially because iscsid is down that sockopt gets used.

Signed-off-by: Mike Christie <michael.christie@oracle.com>
---
 drivers/scsi/iscsi_tcp.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Lee Duncan May 6, 2021, 1:29 a.m. UTC | #1
On 4/24/21 3:17 PM, Mike Christie wrote:
> Userspace (open-iscsi based tools at least) sets no linger on the socket

> to prevent stale data from being sent. However, with the in kernel cleanup

> if userspace is not up the sockfd_put will release the socket without

> having set that sockopt.

> 

> iscsid sets that opt at socket close time, but it seems ok to set this at

> setup time in the kernel for all tools. And, if we are only doing the in

> kernel cleanup initially because iscsid is down that sockopt gets used.

> 

> Signed-off-by: Mike Christie <michael.christie@oracle.com>

> ---

>  drivers/scsi/iscsi_tcp.c | 1 +

>  1 file changed, 1 insertion(+)

> 

> diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c

> index dd33ce0e3737..553e95ad6197 100644

> --- a/drivers/scsi/iscsi_tcp.c

> +++ b/drivers/scsi/iscsi_tcp.c

> @@ -689,6 +689,7 @@ iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,

>  	sk->sk_sndtimeo = 15 * HZ; /* FIXME: make it configurable */

>  	sk->sk_allocation = GFP_ATOMIC;

>  	sk_set_memalloc(sk);

> +	sock_no_linger(sk);

>  

>  	iscsi_sw_tcp_conn_set_callbacks(conn);

>  	tcp_sw_conn->sendpage = tcp_sw_conn->sock->ops->sendpage;

> 


Reviewed-by: Lee Duncan <lduncan@suse.com>
diff mbox series

Patch

diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c
index dd33ce0e3737..553e95ad6197 100644
--- a/drivers/scsi/iscsi_tcp.c
+++ b/drivers/scsi/iscsi_tcp.c
@@ -689,6 +689,7 @@  iscsi_sw_tcp_conn_bind(struct iscsi_cls_session *cls_session,
 	sk->sk_sndtimeo = 15 * HZ; /* FIXME: make it configurable */
 	sk->sk_allocation = GFP_ATOMIC;
 	sk_set_memalloc(sk);
+	sock_no_linger(sk);
 
 	iscsi_sw_tcp_conn_set_callbacks(conn);
 	tcp_sw_conn->sendpage = tcp_sw_conn->sock->ops->sendpage;