Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756259AbdDFARv (ORCPT ); Wed, 5 Apr 2017 20:17:51 -0400 Received: from a2nlsmtp01-05.prod.iad2.secureserver.net ([198.71.225.49]:52554 "EHLO a2nlsmtp01-05.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752436AbdDFARn (ORCPT ); Wed, 5 Apr 2017 20:17:43 -0400 x-originating-ip: 107.180.71.197 From: Long Li To: Jens Axboe , linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: "K. Y. Srinivasan" , Stephen Hemminger , Long Li Subject: [PATCH] block-mq: set both block queue and hardware queue restart bit for restart Date: Wed, 5 Apr 2017 17:16:21 -0700 Message-Id: <1491437781-3565-1-git-send-email-longli@exchange.microsoft.com> X-Mailer: git-send-email 1.7.1 X-CMAE-Envelope: MS4wfMkVTKj6dlYrqdmUn76EfJMr79O7dzuaa/m7JXSPgr31T9JcO36lWhZ8YJeFcPCDaMWFXhkFE6ycGg1MYSmOXzeo0NGfpUHrL3at7S1KOjL5uzjbnBTy hP/Sf4M/9+cHk3BN0oxd/L6BuXUiNsoRpVELyjdRpuSjwAb10NIQdJYMnKk2iamRnbNKs+niJy3B669Yqtvaf5K8IbkpwyHl9arjOOl6ZZyHzBkKtPAOBC8d c9j2gkSnctIRRtB7/Xufv0piATUPJgYYvuyePasM2Qv/3dgZ38xmPaikrijbdA98X5weMLkRMGk0DVbdMx/jg7c6z/jD/rmUnqxvwkEbxS4TTJBEUmRI29GI xsCeLwSi Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1141 Lines: 30 From: Long Li Under heavy I/O, one hardware queue may be unable to dispatch any I/O to the device layer. This poses a problem with restarting this hardware queue on I/O finish in blk_mq_sched_restart_queues(), becaue there is nothing pending that will finish in future on this hardware qeueu. This will result in deadlock. With this patch, we check for all possible stalled hardware queues when I/O finishes on any hardware queues. This prevents this deadlock. Signed-off-by: Long Li --- block/blk-mq-sched.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 09af8ff..f7f3d44 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -202,7 +202,7 @@ void blk_mq_sched_dispatch_requests(struct blk_mq_hw_ctx *hctx) * needing a restart in that case. */ if (!list_empty(&rq_list)) { - blk_mq_sched_mark_restart_hctx(hctx); + blk_mq_sched_mark_restart_queue(hctx); did_work = blk_mq_dispatch_rq_list(hctx, &rq_list); } else if (!has_sched_dispatch) { blk_mq_flush_busy_ctxs(hctx, &rq_list); -- 2.7.4