[PATCH 3/3] nbd: mark sock as dead even if it's the last one
From: Yao Liu
Date: Fri May 24 2019 - 05:58:50 EST
When sock dead, nbd_read_stat should return a ERR_PTR and then we should
mark sock as dead and wait for a reconnection if the dead sock is the last
one, because nbd_xmit_timeout won't resubmit while num_connections <= 1.
Signed-off-by: Yao Liu <yotta.liu@xxxxxxxxx>
---
drivers/block/nbd.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 22e86f4..a557a83 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -716,15 +716,7 @@ static struct nbd_cmd *nbd_read_stat(struct nbd_device *nbd, int index)
if (result <= 0) {
dev_err(disk_to_dev(nbd->disk), "Receive data failed (result %d)\n",
result);
- /*
- * If we've disconnected or we only have 1
- * connection then we need to make sure we
- * complete this request, otherwise error out
- * and let the timeout stuff handle resubmitting
- * this request onto another connection.
- */
- if (nbd_disconnected(config) ||
- config->num_connections <= 1) {
+ if (nbd_disconnected(config)) {
cmd->status = BLK_STS_IOERR;
goto out;
}
--
1.8.3.1