]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
nvme-tcp: fix possible hang waiting for icresp response
authorSagi Grimberg <sagi@grimberg.me>
Thu, 23 Jul 2020 23:42:26 +0000 (16:42 -0700)
committerChristoph Hellwig <hch@lst.de>
Sun, 26 Jul 2020 15:24:27 +0000 (17:24 +0200)
If the controller died exactly when we are receiving icresp
we hang because icresp may never return. Make sure to set a
high finite limit.

Fixes: 3f2304f8c6d6 ("nvme-tcp: add NVMe over TCP host driver")
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/tcp.c

index 79ef2b8e2b3ca738c7f0d81eb70c1cf5a4150245..f3a91818167b1b2c8f942cfffed1217d1f7ba517 100644 (file)
@@ -1382,6 +1382,9 @@ static int nvme_tcp_alloc_queue(struct nvme_ctrl *nctrl,
        if (nctrl->opts->tos >= 0)
                ip_sock_set_tos(queue->sock->sk, nctrl->opts->tos);
 
+       /* Set 10 seconds timeout for icresp recvmsg */
+       queue->sock->sk->sk_rcvtimeo = 10 * HZ;
+
        queue->sock->sk->sk_allocation = GFP_ATOMIC;
        nvme_tcp_set_queue_io_cpu(queue);
        queue->request = NULL;