[PATCH] nvme-target tcp: fix unhandled tcp states in nvmet_tcp_state_change()

Sagi Grimberg sagi at grimberg.me
Wed Aug 10 06:07:29 PDT 2022


> TCP_FIN_WAIT2 and TCP_LAST_ACK were not handled, the connection is closing
> so it's safe to call nvmet_tcp_schedule_release_queue() and avoid printing
> the "unhandled state" warning message.
> 
> [ 1298.852386] nvmet_tcp: queue 2 unhandled state 5
> [ 1298.879112] nvmet_tcp: queue 7 unhandled state 5
> [ 1298.884253] nvmet_tcp: queue 8 unhandled state 5
> [ 1298.889475] nvmet_tcp: queue 9 unhandled state 5
> 
> Signed-off-by: Maurizio Lombardi <mlombard at redhat.com>
> ---
>   drivers/nvme/target/tcp.c | 2 ++
>   1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/nvme/target/tcp.c b/drivers/nvme/target/tcp.c
> index 5f9303232e86..b06a58eb02fc 100644
> --- a/drivers/nvme/target/tcp.c
> +++ b/drivers/nvme/target/tcp.c
> @@ -1524,6 +1524,8 @@ static void nvmet_tcp_state_change(struct sock *sk)
>   
>   	switch (sk->sk_state) {
>   	case TCP_FIN_WAIT1:
> +	case TCP_FIN_WAIT2:
> +	case TCP_LAST_ACK:
>   	case TCP_CLOSE_WAIT:
>   	case TCP_CLOSE:
>   		/* FALLTHRU */

I know that nvmet_tcp_schedule_release_queue is safe, but I think we
for sure called it before these events, so won't it be better for
readability to just do nothing when we get these events?



More information about the Linux-nvme mailing list