On Mon, 2019-04-01 at 12:42 +-0800, Ming Lei wrote: +AD4 Now freeing hw queue resource is moved to hctx's release handler, +AD4 we don't need to worry about the race between blk+AF8-cleanup+AF8-queue and +AD4 run queue any more. +AD4 +AD4 So don't drain in-progress dispatch in blk+AF8-cleanup+AF8-queue(). +AD4 +AD4 This is basically revert of c2856ae2f315 (+ACI-blk-mq: quiesce queue before +AD4 freeing queue+ACI). +AD4 +AD4 Cc: Dongli Zhang +ADw-dongli.zhang+AEA-oracle.com+AD4 +AD4 Cc: James Smart +ADw-james.smart+AEA-broadcom.com+AD4 +AD4 Cc: Bart Van Assche +ADw-bart.vanassche+AEA-wdc.com+AD4 +AD4 Cc: linux-scsi+AEA-vger.kernel.org, +AD4 Cc: Martin K . Petersen +ADw-martin.petersen+AEA-oracle.com+AD4, +AD4 Cc: Christoph Hellwig +ADw-hch+AEA-lst.de+AD4, +AD4 Cc: James E . J . Bottomley +ADw-jejb+AEA-linux.vnet.ibm.com+AD4, +AD4 Cc: jianchao wang +ADw-jianchao.w.wang+AEA-oracle.com+AD4 +AD4 Signed-off-by: Ming Lei +ADw-ming.lei+AEA-redhat.com+AD4 +AD4 --- +AD4 block/blk-core.c +AHw 12 ------------ +AD4 1 file changed, 12 deletions(-) +AD4 +AD4 diff --git a/block/blk-core.c b/block/blk-core.c +AD4 index b3bbf8a5110d..491dc0295778 100644 +AD4 --- a/block/blk-core.c +AD4 +-+-+- b/block/blk-core.c +AD4 +AEAAQA -347,18 +-347,6 +AEAAQA void blk+AF8-cleanup+AF8-queue(struct request+AF8-queue +ACo-q) +AD4 +AD4 blk+AF8-queue+AF8-flag+AF8-set(QUEUE+AF8-FLAG+AF8-DEAD, q)+ADs +AD4 +AD4 - /+ACo +AD4 - +ACo make sure all in-progress dispatch are completed because +AD4 - +ACo blk+AF8-freeze+AF8-queue() can only complete all requests, and +AD4 - +ACo dispatch may still be in-progress since we dispatch requests +AD4 - +ACo from more than one contexts. +AD4 - +ACo +AD4 - +ACo We rely on driver to deal with the race in case that queue +AD4 - +ACo initialization isn't done. +AD4 - +ACo-/ +AD4 - if (queue+AF8-is+AF8-mq(q) +ACYAJg blk+AF8-queue+AF8-init+AF8-done(q)) +AD4 - blk+AF8-mq+AF8-quiesce+AF8-queue(q)+ADs +AD4 - +AD4 /+ACo for synchronous bio-based driver finish in-flight integrity i/o +ACo-/ +AD4 blk+AF8-flush+AF8-integrity()+ADs Many block drivers clean up resources immediately after blk+AF8-cleanup+AF8-queue() returns. Not waiting for ongoing .queue+AF8-rq() calls to finish is wrong because it can cause block drivers to destroy resources that are in use by a concurrent .queue+AF8-rq() call. Bart.