[PATCH 2/3] nbd: unify behavior in timeout no matter how many sockets is configured

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When an nbd device is configured with multiple sockets, the request
is requeued to an active socket in xmit_timeout, the original socket
is closed if not.

Some time, the backend nbd server hang, thus all sockets will be
dropped and the nbd device is not usable. It would be better to have an
option to wait for more time (just reset timer in nbd_xmit_timeout).
Like what we do if we only have one socket. This patch allows it.

Signed-off-by: Hou Pu <houpu@xxxxxxxxxxxxx>
---
 drivers/block/nbd.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 538e9dcf5bf2..4c0bbb981cbc 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -400,8 +400,7 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
 	    nbd->tag_set.timeout)
 		goto error_out;
 
-	if (config->num_connections > 1 ||
-	    (config->num_connections == 1 && nbd->tag_set.timeout)) {
+	if (nbd->tag_set.timeout) {
 		dev_err_ratelimited(nbd_to_dev(nbd),
 				    "Connection timed out, retrying (%d/%d alive)\n",
 				    atomic_read(&config->live_connections),
@@ -432,9 +431,7 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
 			nbd_config_put(nbd);
 			return BLK_EH_DONE;
 		}
-	}
-
-	if (!nbd->tag_set.timeout) {
+	} else {
 		/*
 		 * Userspace sets timeout=0 to disable socket disconnection,
 		 * so just warn and reset the timer.
-- 
2.11.0




[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux