From patchwork Tue Mar 28 20:37:52 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Bacik X-Patchwork-Id: 9650479 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id D48A9601E9 for ; Tue, 28 Mar 2017 20:37:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BAB6E283F3 for ; Tue, 28 Mar 2017 20:37:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AF32C2841A; Tue, 28 Mar 2017 20:37:56 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 032E5283F3 for ; Tue, 28 Mar 2017 20:37:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754364AbdC1Uh4 (ORCPT ); Tue, 28 Mar 2017 16:37:56 -0400 Received: from mail-qk0-f196.google.com ([209.85.220.196]:36740 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754234AbdC1Uhz (ORCPT ); Tue, 28 Mar 2017 16:37:55 -0400 Received: by mail-qk0-f196.google.com with SMTP id r142so10359449qke.3 for ; Tue, 28 Mar 2017 13:37:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=jQWGjAVadeqaqlCSrA31Flm85kk8vToUpDV48o7bUEk=; b=ceoIznhKRjJR6SFIvQih6eo+1qP8DGn3/GHJvMARHHGyh6/ZwsECYvQRQpO55m+W7Y QMbNyqv5DOnWMrcVa4YOK6w8NzwAbk6N1nyXAcKwB/ReyFzVw/qO88q4M0IbLmmfUxgq QpB5+hh8TZrkAmaXhoRDy6IRK67aft5GJe1Nr3N+AIzFaNVcXl5aWLAM5/jzYecaBVt4 aHSANKeBVTpyaFrQg42TnVmFnzImMHir6O92pvuW/TD2vKFESjCdDiag0v+Vtr96vzpb F/K8WSnp7KV4tBvKLtTbpVPNgz7/dL8875qeO08gcByWjOhNtMOzgKSCbqx26WKonV4X RTBA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=jQWGjAVadeqaqlCSrA31Flm85kk8vToUpDV48o7bUEk=; b=mTuQLkQ4c7VbaUK1C5Xn3MhAyr4oWdWE/+xCrXsZlbOBMLIT0DZhdTMwOsP0CPRU+f YJRCrjJ6GYHkwxFFby9LTDm2Kl5gYo3f9bAwgAgXDX+u5gfwZylR2l1cG7cfn/3M2nLW k5A389AmWdstUooXpUzulT/jx6pevSUotZ3tsBjqrwIcLgmXp/autcW64Olo7/nYoyqf +3LXs62tOsVNcwIyDWREW7Um/va7s7w1HWU6zvbrYgCFvhNNwQbvaHgv/bVjqc//uAEs ylh3y6fAU7oEFZO9cuE8qyuipZNw5HLSqm5tBJuSYK5vgTIr8TbCDLTIklwx2bbMRmuy /tNQ== X-Gm-Message-State: AFeK/H3UZ4zG+4Uocw1pQRxGl3EdkpFzMgeJgkxj3Nznlv9Zm86joUiPyOKPcBDRcFAeJg== X-Received: by 10.233.239.151 with SMTP id d145mr14567154qkg.313.1490733473690; Tue, 28 Mar 2017 13:37:53 -0700 (PDT) Received: from localhost (cpe-2606-A000-4381-1201-225-22FF-FEB3-E51A.dyn6.twc.com. [2606:a000:4381:1201:225:22ff:feb3:e51a]) by smtp.gmail.com with ESMTPSA id p184sm3431572qkb.17.2017.03.28.13.37.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 28 Mar 2017 13:37:53 -0700 (PDT) From: Josef Bacik X-Google-Original-From: Josef Bacik To: linux-block@vger.kernel.org, kernel-team@fb.com Subject: [PATCH] block-mq: don't re-queue if we get a queue error Date: Tue, 28 Mar 2017 16:37:52 -0400 Message-Id: <1490733472-3088-1-git-send-email-jbacik@fb.com> X-Mailer: git-send-email 2.7.4 Sender: linux-block-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-block@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When try to issue a request directly and we fail we will requeue the request, but call blk_mq_end_request() as well. This leads to the completed request being on a queuelist and getting ended twice, which causes list corruption in schedulers and other shenanigans. Signed-off-by: Josef Bacik Reviewed-by: Ming Lei Reviewed-by: Sagi Grimberg --- block/blk-mq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/block/blk-mq.c b/block/blk-mq.c index 08a49c6..c5a6985 100644 --- a/block/blk-mq.c +++ b/block/blk-mq.c @@ -1457,8 +1457,6 @@ static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie, return; } - __blk_mq_requeue_request(rq); - if (ret == BLK_MQ_RQ_QUEUE_ERROR) { *cookie = BLK_QC_T_NONE; rq->errors = -EIO; @@ -1466,6 +1464,7 @@ static void blk_mq_try_issue_directly(struct request *rq, blk_qc_t *cookie, return; } + __blk_mq_requeue_request(rq); insert: blk_mq_sched_insert_request(rq, false, true, false, may_sleep); }