All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH V4 0/7] blk-mq: fix races related with freeing queue
@ 2019-04-04  8:43 Ming Lei
  2019-04-04  8:43 ` [PATCH V4 1/7] blk-mq: grab .q_usage_counter when queuing request from plug code path Ming Lei
                   ` (6 more replies)
  0 siblings, 7 replies; 18+ messages in thread
From: Ming Lei @ 2019-04-04  8:43 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Ming Lei, Dongli Zhang, James Smart,
	Bart Van Assche, linux-scsi, Martin K . Petersen,
	Christoph Hellwig, James E . J . Bottomley, jianchao wang

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.

V4:
	- add patch for fixing potential use-after-free in blk_mq_update_nr_hw_queues
	- fix comment in the last patch

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 (7):
  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: quiesce queue before updating nr_hw_queues
  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          | 25 +++++++++++++++++--------
 block/blk-mq.h          |  2 +-
 drivers/scsi/scsi_lib.c | 28 ++--------------------------
 5 files changed, 29 insertions(+), 57 deletions(-)

Cc: Dongli Zhang <dongli.zhang@oracle.com>
Cc: James Smart <james.smart@broadcom.com>
Cc: Bart Van Assche <bart.vanassche@wdc.com>
Cc: linux-scsi@vger.kernel.org,
Cc: Martin K . Petersen <martin.petersen@oracle.com>,
Cc: Christoph Hellwig <hch@lst.de>,
Cc: James E . J . Bottomley <jejb@linux.vnet.ibm.com>,
Cc: jianchao wang <jianchao.w.wang@oracle.com>
-- 
2.9.5


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

end of thread, other threads:[~2019-04-08  9:02 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-04  8:43 [PATCH V4 0/7] blk-mq: fix races related with freeing queue Ming Lei
2019-04-04  8:43 ` [PATCH V4 1/7] blk-mq: grab .q_usage_counter when queuing request from plug code path Ming Lei
2019-04-04 15:58   ` Bart Van Assche
2019-04-04 20:45     ` Ming Lei
2019-04-04 21:30   ` Bart Van Assche
2019-04-05  9:26   ` Dongli Zhang
2019-04-05 13:52     ` Ming Lei
2019-04-04  8:43 ` [PATCH V4 2/7] blk-mq: move cancel of requeue_work into blk_mq_release Ming Lei
2019-04-04  8:43 ` [PATCH V4 3/7] blk-mq: quiesce queue before updating nr_hw_queues Ming Lei
2019-04-04 15:57   ` Bart Van Assche
2019-04-04 20:55     ` Ming Lei
2019-04-08  3:16   ` jianchao.wang
2019-04-08  9:01     ` Ming Lei
2019-04-04  8:43 ` [PATCH V4 4/7] blk-mq: free hw queue's resource in hctx's release handler Ming Lei
2019-04-04  8:43 ` [PATCH V4 5/7] blk-mq: move cancel of hctx->run_work into blk_mq_hw_sysfs_release Ming Lei
2019-04-04  8:43 ` [PATCH V4 6/7] block: don't drain in-progress dispatch in blk_cleanup_queue() Ming Lei
2019-04-04  8:43 ` [PATCH V4 7/7] SCSI: don't hold device refcount in IO path Ming Lei
2019-04-04 17:14   ` Bart Van Assche

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.