Skip to contentSkip to conversation

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

PATCH Superseded Maurizio Lombardi 2 participants 2 messages Aug 2, 2022 – Aug 10, 2022

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nvme-target tcp: fix unhandled tcp states in nvmet_tcp_state_change()

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
---
 drivers/nvme/target/tcp.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/nvme/target/tcp.c +2 -0
index 5f9303232e86..b06a58eb02fc 100644
@@ -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 */
Signature · 1 line
2.31.1
maintainer
#1 lore raw
Quoted 20 lines

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
---
  drivers/nvme/target/tcp.c | 2 ++
  1 file changed, 2 insertions(+)
drivers/nvme/target/tcp.c +0 -0
index 5f9303232e86..b06a58eb02fc 100644

drivers/nvme/target/tcp.c static void nvmet_tcp_state_change(struct sock *sk) · line 1531

Quoted 8 lines
drivers/nvme/target/tcp.c +2 -0
@@ -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?