Skip to content

Commit 1b97871

Browse files
Ming Leiaxboe
authored andcommitted
blk-mq: move cancel of hctx->run_work into blk_mq_hw_sysfs_release
hctx is always released after requeue is freed. With holding queue's kobject refcount, it is safe for driver to run queue, so one run queue might be scheduled after blk_sync_queue() is done. So moving the cancel of hctx->run_work into blk_mq_hw_sysfs_release() for avoiding run released queue. 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>, Reviewed-by: Bart Van Assche <bvanassche@acm.org> Reviewed-by: Hannes Reinecke <hare@suse.com> Tested-by: James Smart <james.smart@broadcom.com> Signed-off-by: Ming Lei <ming.lei@redhat.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 2f8f133 commit 1b97871

2 files changed

Lines changed: 2 additions & 8 deletions

File tree

‎block/blk-core.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,14 +233,6 @@ void blk_sync_queue(struct request_queue *q)
233233
{
234234
del_timer_sync(&q->timeout);
235235
cancel_work_sync(&q->timeout_work);
236-
237-
if (queue_is_mq(q)) {
238-
struct blk_mq_hw_ctx *hctx;
239-
int i;
240-
241-
queue_for_each_hw_ctx(q, hctx, i)
242-
cancel_delayed_work_sync(&hctx->run_work);
243-
}
244236
}
245237
EXPORT_SYMBOL(blk_sync_queue);
246238

‎block/blk-mq-sysfs.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ static void blk_mq_hw_sysfs_release(struct kobject *kobj)
3636
struct blk_mq_hw_ctx *hctx = container_of(kobj, struct blk_mq_hw_ctx,
3737
kobj);
3838

39+
cancel_delayed_work_sync(&hctx->run_work);
40+
3941
if (hctx->flags & BLK_MQ_F_BLOCKING)
4042
cleanup_srcu_struct(hctx->srcu);
4143
blk_free_flush_queue(hctx->fq);

0 commit comments

Comments
 (0)