* [PATCH] blk-mq: Fix queue usage on failed request allocation
@ 2017-08-14 20:40 Keith Busch
2017-08-15 2:46 ` Ming Lei
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Keith Busch @ 2017-08-14 20:40 UTC (permalink / raw)
To: linux-nvme, linux-block, Jens Axboe; +Cc: Max Gurtovoy, Ming Lei, Keith Busch
blk_mq_get_request() does not release the callers queue usage counter
when allocation fails. The caller still needs to account for its own
queue usage when it is unable to allocate a request.
Fixes: 1ad43c0078b7 ("blk-mq: don't leak preempt counter/q_usage_counter when allocating rq failed")
Reported-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
---
block/blk-mq.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/block/blk-mq.c b/block/blk-mq.c
index 535cbdf..4603b11 100644
--- a/block/blk-mq.c
+++ b/block/blk-mq.c
@@ -360,12 +360,12 @@ struct request *blk_mq_alloc_request(struct request_queue *q, unsigned int op,
return ERR_PTR(ret);
rq = blk_mq_get_request(q, NULL, op, &alloc_data);
+ blk_queue_exit(q);
if (!rq)
return ERR_PTR(-EWOULDBLOCK);
blk_mq_put_ctx(alloc_data.ctx);
- blk_queue_exit(q);
rq->__data_len = 0;
rq->__sector = (sector_t) -1;
@@ -411,12 +411,11 @@ struct request *blk_mq_alloc_request_hctx(struct request_queue *q,
alloc_data.ctx = __blk_mq_get_ctx(q, cpu);
rq = blk_mq_get_request(q, NULL, op, &alloc_data);
+ blk_queue_exit(q);
if (!rq)
return ERR_PTR(-EWOULDBLOCK);
- blk_queue_exit(q);
-
return rq;
}
EXPORT_SYMBOL_GPL(blk_mq_alloc_request_hctx);
--
2.5.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] blk-mq: Fix queue usage on failed request allocation
2017-08-14 20:40 [PATCH] blk-mq: Fix queue usage on failed request allocation Keith Busch
@ 2017-08-15 2:46 ` Ming Lei
2017-08-15 9:53 ` Sagi Grimberg
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Ming Lei @ 2017-08-15 2:46 UTC (permalink / raw)
To: Keith Busch; +Cc: linux-nvme, linux-block, Jens Axboe, Max Gurtovoy, Ming Lei
On Mon, Aug 14, 2017 at 04:40:11PM -0400, Keith Busch wrote:
> blk_mq_get_request() does not release the callers queue usage counter
> when allocation fails. The caller still needs to account for its own
> queue usage when it is unable to allocate a request.
>
> Fixes: 1ad43c0078b7 ("blk-mq: don't leak preempt counter/q_usage_counter when allocating rq failed")
>
> Reported-by: Max Gurtovoy <maxg@mellanox.com>
> Signed-off-by: Keith Busch <keith.busch@intel.com>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
--
Ming
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk-mq: Fix queue usage on failed request allocation
2017-08-14 20:40 [PATCH] blk-mq: Fix queue usage on failed request allocation Keith Busch
2017-08-15 2:46 ` Ming Lei
@ 2017-08-15 9:53 ` Sagi Grimberg
2017-08-15 11:58 ` Max Gurtovoy
2017-08-15 13:22 ` Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Sagi Grimberg @ 2017-08-15 9:53 UTC (permalink / raw)
To: Keith Busch, linux-nvme, linux-block, Jens Axboe; +Cc: Max Gurtovoy, Ming Lei
Looks good,
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk-mq: Fix queue usage on failed request allocation
2017-08-14 20:40 [PATCH] blk-mq: Fix queue usage on failed request allocation Keith Busch
2017-08-15 2:46 ` Ming Lei
2017-08-15 9:53 ` Sagi Grimberg
@ 2017-08-15 11:58 ` Max Gurtovoy
2017-08-15 13:22 ` Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Max Gurtovoy @ 2017-08-15 11:58 UTC (permalink / raw)
To: Keith Busch, linux-nvme, linux-block, Jens Axboe; +Cc: Ming Lei
On 8/14/2017 11:40 PM, Keith Busch wrote:
> blk_mq_get_request() does not release the callers queue usage counter
> when allocation fails. The caller still needs to account for its own
> queue usage when it is unable to allocate a request.
>
> Fixes: 1ad43c0078b7 ("blk-mq: don't leak preempt counter/q_usage_counter when allocating rq failed")
>
> Reported-by: Max Gurtovoy <maxg@mellanox.com>
> Signed-off-by: Keith Busch <keith.busch@intel.com>
> ---
tested with 4.13-rc5+ using the following commands in a loop:
1. modprobe nvme
2. sleep 10
3. modprobe -r nvme
Looks good,
Tested-by: Max Gurtovoy <maxg@mellanox.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] blk-mq: Fix queue usage on failed request allocation
2017-08-14 20:40 [PATCH] blk-mq: Fix queue usage on failed request allocation Keith Busch
` (2 preceding siblings ...)
2017-08-15 11:58 ` Max Gurtovoy
@ 2017-08-15 13:22 ` Jens Axboe
3 siblings, 0 replies; 5+ messages in thread
From: Jens Axboe @ 2017-08-15 13:22 UTC (permalink / raw)
To: Keith Busch, linux-nvme, linux-block; +Cc: Max Gurtovoy, Ming Lei
On 08/14/2017 02:40 PM, Keith Busch wrote:
> blk_mq_get_request() does not release the callers queue usage counter
> when allocation fails. The caller still needs to account for its own
> queue usage when it is unable to allocate a request.
Thanks Keith, applied.
--
Jens Axboe
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-08-15 13:22 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-14 20:40 [PATCH] blk-mq: Fix queue usage on failed request allocation Keith Busch
2017-08-15 2:46 ` Ming Lei
2017-08-15 9:53 ` Sagi Grimberg
2017-08-15 11:58 ` Max Gurtovoy
2017-08-15 13:22 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox