diff mbox series

um: Entrust re-queue to the upper layers

Message ID 20191028170543.27591-1-anton.ivanov@cambridgegreys.com
State Not Applicable
Headers show
Series um: Entrust re-queue to the upper layers | expand

Commit Message

Anton Ivanov Oct. 28, 2019, 5:05 p.m. UTC
Fixes crashes due to ubd requeue logic conflicting with the block-mq
one.

Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com>
---
 arch/um/drivers/ubd_kern.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jens Axboe Oct. 28, 2019, 5:28 p.m. UTC | #1
On 10/28/19 11:05 AM, Anton Ivanov wrote:
> Fixes crashes due to ubd requeue logic conflicting with the block-mq
> one.

First of all, great work getting this far! This is surely a bug.
Probably needs a Fixes entry, and a CC stable.

There are actually two cases that'll return an error here, and one is
global and the other is per-device. If the kmalloc() fails in
ubd_queue_one_vec(), we should be returning BLK_STS_RESOURCE. Didn't
look at the -EAGAIN part, but maybe that's a global resource as well
when it fails? If so, then both should return BLK_STS_RESOURCE. If not,
then that should return BLK_STS_DEV_RESOURCE, as your change did.

Hence if both are global, just make it:

if (ret < 0)
	res = BLK_STS_DEV_RESOURCE;

and if one is a per-device thing, then I'd make ubd_queue_one_vec()
return the BLK_STS_* type and propagate that down to the caller.
diff mbox series

Patch

diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c
index 33c1cd6a12ac..3fe2a986f2c4 100644
--- a/arch/um/drivers/ubd_kern.c
+++ b/arch/um/drivers/ubd_kern.c
@@ -1404,7 +1404,7 @@  static blk_status_t ubd_queue_rq(struct blk_mq_hw_ctx *hctx,
 	spin_unlock_irq(&ubd_dev->lock);
 
 	if (ret < 0)
-		blk_mq_requeue_request(req, true);
+		return BLK_STS_DEV_RESOURCE;
 
 	return res;
 }