diff mbox

[04/14] nbd: complete requests from ->timeout

Message ID 20180523121941.8632-5-hch@lst.de (mailing list archive)
State New, archived
Headers show

Commit Message

Christoph Hellwig May 23, 2018, 12:19 p.m. UTC
By completing the request entirely in the driver we can remove the
BLK_EH_HANDLED return value and thus the split responsibility between the
driver and the block layer that has been causing trouble.

Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 drivers/block/nbd.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Hannes Reinecke May 23, 2018, 1:28 p.m. UTC | #1
On 05/23/2018 02:19 PM, Christoph Hellwig wrote:
> By completing the request entirely in the driver we can remove the
> BLK_EH_HANDLED return value and thus the split responsibility between the
> driver and the block layer that has been causing trouble.
> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>   drivers/block/nbd.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
> index 09d9959287fe..30a851b8a99c 100644
> --- a/drivers/block/nbd.c
> +++ b/drivers/block/nbd.c
> @@ -300,7 +300,7 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
>   
>   	if (!refcount_inc_not_zero(&nbd->config_refs)) {
>   		cmd->status = BLK_STS_TIMEOUT;
> -		return BLK_EH_HANDLED;
> +		goto done;
>   	}
>   	config = nbd->config;
>   
> @@ -338,8 +338,9 @@ static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
>   	cmd->status = BLK_STS_IOERR;
>   	sock_shutdown(nbd);
>   	nbd_config_put(nbd);
> -
> -	return BLK_EH_HANDLED;
> +done:
> +	blk_mq_complete_request(req);
> +	return BLK_EH_DONE;
>   }
>   
>   /*
> 
Again, some testcase would be nice ...

Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
Christoph Hellwig May 28, 2018, 3:25 p.m. UTC | #2
On Wed, May 23, 2018 at 03:28:38PM +0200, Hannes Reinecke wrote:
> Again, some testcase would be nice ...

For this one I don't have an actual test case.  I'll have to defer
to the nbd maintainers for that.
diff mbox

Patch

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 09d9959287fe..30a851b8a99c 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -300,7 +300,7 @@  static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
 
 	if (!refcount_inc_not_zero(&nbd->config_refs)) {
 		cmd->status = BLK_STS_TIMEOUT;
-		return BLK_EH_HANDLED;
+		goto done;
 	}
 	config = nbd->config;
 
@@ -338,8 +338,9 @@  static enum blk_eh_timer_return nbd_xmit_timeout(struct request *req,
 	cmd->status = BLK_STS_IOERR;
 	sock_shutdown(nbd);
 	nbd_config_put(nbd);
-
-	return BLK_EH_HANDLED;
+done:
+	blk_mq_complete_request(req);
+	return BLK_EH_DONE;
 }
 
 /*