linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH V3 0/6] blk-mq: fix races related with freeing queue
@ 2019-04-03 10:26 Ming Lei
  2019-04-03 10:26 ` [PATCH V3 1/6] blk-mq: grab .q_usage_counter when queuing request from plug code path Ming Lei
                   ` (5 more replies)
  0 siblings, 6 replies; 19+ messages in thread
From: Ming Lei @ 2019-04-03 10:26 UTC (permalink / raw)
  To: Jens Axboe; +Cc: linux-block, Ming Lei

Hi,

Since 45a9c9d909b2 ("blk-mq: Fix a use-after-free"), run queue isn't
allowed during cleanup queue even though queue refcount is held.

This change has caused lots of kernel oops triggered in run queue path,
turns out it isn't easy to fix them all.

So move freeing of hw queue resources into hctx's release handler, then
the above issue is fixed. Meantime, this way is safe given freeing hw
queue resource doesn't require tags.

V3 covers more races.

V3:
	- cancel q->requeue_work in queue's release handler
	- cancel hctx->run_work in hctx's release handler
	- add patch 1 for fixing race in plug code path
	- the last patch is added for avoiding to grab SCSI's refcont
	in IO path

V2:
	- moving freeing hw queue resources into hctx's release handler


Ming Lei (6):
  blk-mq: grab .q_usage_counter when queuing request from plug code path
  blk-mq: move cancel of requeue_work into blk_mq_release
  blk-mq: free hw queue's resource in hctx's release handler
  blk-mq: move cancel of hctx->run_work into blk_mq_hw_sysfs_release
  block: don't drain in-progress dispatch in blk_cleanup_queue()
  SCSI: don't hold device refcount in IO path

 block/blk-core.c        | 23 +----------------------
 block/blk-mq-sysfs.c    |  8 ++++++++
 block/blk-mq.c          | 16 ++++++++++------
 block/blk-mq.h          |  2 +-
 drivers/scsi/scsi_lib.c | 30 ++++++------------------------
 5 files changed, 26 insertions(+), 53 deletions(-)

-- 
2.9.5


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

end of thread, other threads:[~2019-04-04  7:43 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-03 10:26 [PATCH V3 0/6] blk-mq: fix races related with freeing queue Ming Lei
2019-04-03 10:26 ` [PATCH V3 1/6] blk-mq: grab .q_usage_counter when queuing request from plug code path Ming Lei
2019-04-03 15:21   ` Bart Van Assche
2019-04-03 16:27     ` Ming Lei
2019-04-03 21:22       ` Bart Van Assche
2019-04-04  6:57         ` Ming Lei
2019-04-03 10:26 ` [PATCH V3 2/6] blk-mq: move cancel of requeue_work into blk_mq_release Ming Lei
2019-04-03 16:19   ` Bart Van Assche
2019-04-03 10:26 ` [PATCH V3 3/6] blk-mq: free hw queue's resource in hctx's release handler Ming Lei
2019-04-03 16:26   ` Bart Van Assche
2019-04-04  6:40     ` Ming Lei
2019-04-04  7:42     ` Ming Lei
2019-04-03 10:26 ` [PATCH V3 4/6] blk-mq: move cancel of hctx->run_work into blk_mq_hw_sysfs_release Ming Lei
2019-04-03 16:21   ` Bart Van Assche
2019-04-03 10:26 ` [PATCH V3 5/6] block: don't drain in-progress dispatch in blk_cleanup_queue() Ming Lei
2019-04-03 15:25   ` Bart Van Assche
2019-04-03 10:26 ` [PATCH V3 6/6] SCSI: don't hold device refcount in IO path Ming Lei
2019-04-03 16:24   ` Bart Van Assche
2019-04-04  6:47     ` Ming Lei

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).