On Thu, 2019-04-04 at 15:08 +-0800, Ming Lei wrote: +AD4 On Wed, Apr 03, 2019 at 01:11:26PM -0700, Bart Van Assche wrote: +AD4 +AD4 If blk+AF8-mq+AF8-try+AF8-issue+AF8-directly() returns BLK+AF8-STS+ACoAXw-RESOURCE that means that +AD4 +AD4 the request has not been queued and that the caller should retry to submit +AD4 +AD4 the request. Both blk+AF8-mq+AF8-request+AF8-bypass+AF8-insert() and +AD4 +AD4 blk+AF8-mq+AF8-sched+AF8-insert+AF8-request() guarantee that a request will be processed. +AD4 +AD4 Hence return BLK+AF8-STS+AF8-OK if one of these functions is called. This patch +AD4 +AD4 avoids that blk+AF8-mq+AF8-dispatch+AF8-rq+AF8-list() crashes when using dm-mpath. +AD4 +AD4 +AD4 +AD4 Cc: Christoph Hellwig +ADw-hch+AEA-infradead.org+AD4 +AD4 +AD4 Cc: Hannes Reinecke +ADw-hare+AEA-suse.com+AD4 +AD4 +AD4 Cc: James Smart +ADw-james.smart+AEA-broadcom.com+AD4 +AD4 +AD4 Cc: Ming Lei +ADw-ming.lei+AEA-redhat.com+AD4 +AD4 +AD4 Cc: Jianchao Wang +ADw-jianchao.w.wang+AEA-oracle.com+AD4 +AD4 +AD4 Cc: Keith Busch +ADw-keith.busch+AEA-intel.com+AD4 +AD4 +AD4 Cc: Dongli Zhang +ADw-dongli.zhang+AEA-oracle.com+AD4 +AD4 +AD4 Cc: Laurence Oberman +ADw-loberman+AEA-redhat.com+AD4 +AD4 +AD4 Tested-by: Laurence Oberman +ADw-loberman+AEA-redhat.com+AD4 +AD4 +AD4 Reviewed-by: Laurence Oberman +ADw-loberman+AEA-redhat.com+AD4 +AD4 +AD4 Reported-by: Laurence Oberman +ADw-loberman+AEA-redhat.com+AD4 +AD4 +AD4 Fixes: 7f556a44e61d (+ACI-blk-mq: refactor the code of issue request directly+ACI) +ACM v5.0. +AD4 +AD4 Cc: +ADw-stable+AEA-vger.kernel.org+AD4 +AD4 +AD4 Signed-off-by: Bart Van Assche +ADw-bvanassche+AEA-acm.org+AD4 +AD4 +AD4 --- +AD4 +AD4 block/blk-mq.c +AHw 9 +-+-------- +AD4 +AD4 1 file changed, 2 insertions(+-), 7 deletions(-) +AD4 +AD4 +AD4 +AD4 diff --git a/block/blk-mq.c b/block/blk-mq.c +AD4 +AD4 index 652d0c6d5945..b2c20dce8a30 100644 +AD4 +AD4 --- a/block/blk-mq.c +AD4 +AD4 +-+-+- b/block/blk-mq.c +AD4 +AD4 +AEAAQA -1859,16 +-1859,11 +AEAAQA blk+AF8-status+AF8-t blk+AF8-mq+AF8-try+AF8-issue+AF8-directly(struct blk+AF8-mq+AF8-hw+AF8-ctx +ACo-hctx, +AD4 +AD4 case BLK+AF8-STS+AF8-RESOURCE: +AD4 +AD4 if (force) +AHs +AD4 +AD4 blk+AF8-mq+AF8-request+AF8-bypass+AF8-insert(rq, run+AF8-queue)+ADs +AD4 +AD4 - /+ACo +AD4 +AD4 - +ACo We have to return BLK+AF8-STS+AF8-OK for the DM +AD4 +AD4 - +ACo to avoid livelock. Otherwise, we return +AD4 +AD4 - +ACo the real result to indicate whether the +AD4 +AD4 - +ACo request is direct-issued successfully. +AD4 +AD4 - +ACo-/ +AD4 +AD4 - ret +AD0 bypass ? BLK+AF8-STS+AF8-OK : ret+ADs +AD4 +AD4 +- ret +AD0 BLK+AF8-STS+AF8-OK+ADs +AD4 +AD4 +AH0 else if (+ACE-bypass) +AHs +AD4 +AD4 blk+AF8-mq+AF8-sched+AF8-insert+AF8-request(rq, false, +AD4 +AD4 run+AF8-queue, false)+ADs +AD4 +AD4 +- ret +AD0 BLK+AF8-STS+AF8-OK+ADs +AD4 +AD4 +AH0 +AD4 +AD4 This change itself is correct. +AD4 +AD4 However, there is other issue introduced by 7f556a44e61d. +AD4 +AD4 We need blk+AF8-insert+AF8-cloned+AF8-request() to pass back BLK+AF8-STS+AF8-RESOURCE/BLK+AF8-STS+AF8-RESOURCE +AD4 to caller, so that dm-rq driver may see the underlying queue is busy, then tell +AD4 blk-mq to deal with the busy condition from dm-rq queue, so that IO +AD4 merge can get improved. +AD4 +AD4 That is exactly what 396eaf21ee17c476e8f6 (+ACI-blk-mq: improve DM's blk-mq IO merging +AD4 via blk+AF8-insert+AF8-cloned+AF8-request feedback+ACI) did. +AD4 +AD4 There must be performance regression with 7f556a44e61d by cut the feedback. +AD4 +AD4 So could you fix them all in one patch? Since commit 7f556a44e61d introduced multiple problems and since fixing these is nontrivial, how about reverting that commit? Thanks, Bart.