Skip to contentSkip to conversation

nbd: Abort request on data reception failure

PATCH In review Michal Feix 2 participants 2 messages Jul 16, 2006 – Jul 17, 2006

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nbd: Abort request on data reception failure

When reading from nbd device, we need to receive all the data after receiving reply packet from the server - otherwise such request will never be ended.

If socket is closed right after accepting reply control packet and in the middle of waiting for read data, nbd_read_stat() returns NULL and nbd_end_request() is not called.

This patch fixes it.

---

drivers/block/nbd.c +2 -1
diff -upr 2.6.18-rc2.orig/drivers/block/nbd.c 2.6.18-rc2/drivers/block/nbd.c
@@ -339,7 +339,8 @@ static struct request *nbd_read_stat(str
 					printk(KERN_ERR "%s: Receive data failed (result %d)\n",
 							lo->disk->disk_name,
 							result);
-					goto harderror;
+					req->errors++;
+					return req;
 				}
 				dprintk(DBG_RX, "%s: request %p: got %d bytes data\n",
 					lo->disk->disk_name, req, bvec->bv_len);
#1 lore raw
Quoted 7 lines · Michal Feix

When reading from nbd device, we need to receive all the data after receiving reply packet from the server - otherwise such request will never be ended.

If socket is closed right after accepting reply control packet and in the middle of waiting for read data, nbd_read_stat() returns NULL and nbd_end_request() is not called.

That's right. We can't return NULL after pulling the request off the queue.

Thanks,
Paul