public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nbd: Abort request on data reception failure
@ 2006-07-16 13:17 Michal Feix
  2006-07-17 15:26 ` Paul Clements
  0 siblings, 1 reply; 2+ messages in thread
From: Michal Feix @ 2006-07-16 13:17 UTC (permalink / raw)
  To: Paul.Clements; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 399 bytes --]

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.

Signed-off-by: Michal Feix <michal@feix.cz>
---


[-- Attachment #2: nbd.c.always-end-request.diff --]
[-- Type: text/plain, Size: 569 bytes --]

diff -upr 2.6.18-rc2.orig/drivers/block/nbd.c 2.6.18-rc2/drivers/block/nbd.c
--- 2.6.18-rc2.orig/drivers/block/nbd.c	2006-07-16 15:08:07.866293000 +0200
+++ 2.6.18-rc2/drivers/block/nbd.c	2006-07-16 15:08:55.361261250 +0200
@@ -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);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] nbd: Abort request on data reception failure
  2006-07-16 13:17 [PATCH] nbd: Abort request on data reception failure Michal Feix
@ 2006-07-17 15:26 ` Paul Clements
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Clements @ 2006-07-17 15:26 UTC (permalink / raw)
  To: Michal Feix; +Cc: linux-kernel

Michal Feix wrote:
> 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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-07-17 15:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-16 13:17 [PATCH] nbd: Abort request on data reception failure Michal Feix
2006-07-17 15:26 ` Paul Clements

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox