public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nbd: fix -ERESTARTSYS handling
@ 2017-10-02 20:22 Josef Bacik
  2017-10-02 20:29 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Josef Bacik @ 2017-10-02 20:22 UTC (permalink / raw)
  To: axboe, kernel-team, linux-block

Christoph made it so that if we return'ed BLK_STS_RESOURCE whenever we
got ERESTARTSYS from sending our packets we'd return BLK_STS_OK, which
means we'd never requeue and just hang.  We really need to return the
right value from the upper layer.

Fixes: fc17b6534eb8 ("blk-mq: switch ->queue_rq return value to blk_status_t")
Signed-off-by: Josef Bacik <jbacik@fb.com>
---
 drivers/block/nbd.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index 3684e21d543f..883dfebd3014 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -820,9 +820,13 @@ static blk_status_t nbd_queue_rq(struct blk_mq_hw_ctx *hctx,
 	 * appropriate.
 	 */
 	ret = nbd_handle_cmd(cmd, hctx->queue_num);
+	if (ret < 0)
+		ret = BLK_STS_IOERR;
+	else if (!ret)
+		ret = BLK_STS_OK;
 	complete(&cmd->send_complete);
 
-	return ret < 0 ? BLK_STS_IOERR : BLK_STS_OK;
+	return ret;
 }
 
 static int nbd_add_socket(struct nbd_device *nbd, unsigned long arg,
-- 
2.7.4

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

* Re: [PATCH] nbd: fix -ERESTARTSYS handling
  2017-10-02 20:22 [PATCH] nbd: fix -ERESTARTSYS handling Josef Bacik
@ 2017-10-02 20:29 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2017-10-02 20:29 UTC (permalink / raw)
  To: Josef Bacik, kernel-team, linux-block

On 10/02/2017 02:22 PM, Josef Bacik wrote:
> Christoph made it so that if we return'ed BLK_STS_RESOURCE whenever we
> got ERESTARTSYS from sending our packets we'd return BLK_STS_OK, which
> means we'd never requeue and just hang.  We really need to return the
> right value from the upper layer.

Applied for 4.14, thanks.

-- 
Jens Axboe

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

end of thread, other threads:[~2017-10-02 20:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-02 20:22 [PATCH] nbd: fix -ERESTARTSYS handling Josef Bacik
2017-10-02 20:29 ` Jens Axboe

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