From patchwork Thu Apr 20 22:45:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Axboe X-Patchwork-Id: 9691471 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 DAE5C6037F for ; Thu, 20 Apr 2017 22:46:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BE9DB28409 for ; Thu, 20 Apr 2017 22:46:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AEED428433; Thu, 20 Apr 2017 22:46:01 +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 3E76A28409 for ; Thu, 20 Apr 2017 22:46:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1032623AbdDTWqA (ORCPT ); Thu, 20 Apr 2017 18:46:00 -0400 Received: from mail-io0-f179.google.com ([209.85.223.179]:33867 "EHLO mail-io0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1032435AbdDTWqA (ORCPT ); Thu, 20 Apr 2017 18:46:00 -0400 Received: by mail-io0-f179.google.com with SMTP id a103so91430049ioj.1 for ; Thu, 20 Apr 2017 15:45:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel-dk.20150623.gappssmtp.com; s=20150623; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding; bh=TjEy7I+4r8r73AyP745nmXC1tkkkEVlJbroHHF3IHfA=; b=WYizrineWS5bO/1tW5urQm5BIZbY8u5/NFHdTvZ2jZMgp3JrBa21rDCriylrHn09Cj FpEj+T6mAWThtstIUK9o8yPu/Swu4aXlHqzkdQqws1ne+1blgmk7C/DE2fWeo6p9N8Zv eppfZKpTTw5kMFfgo/Pg+055WwiVR1k+TstBXfNYRa/Bn7zHT/Mkm61ntLFfmyiqml4D hhDGQlxlyhoFetm1cv0i6WJBlHpJx5FLFjCQ1jNhM6P+hZ1bDrst0pDgJeS4NBEXWH0t xrLeyWCPTCrBi8O5nAKOijHGbom+BUxiqRo0jUqnDpr3ZENqpvPAkboui2BCFRBQwGjt oXvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding; bh=TjEy7I+4r8r73AyP745nmXC1tkkkEVlJbroHHF3IHfA=; b=avQX0fu3zQUTobkZp0o1SxBQ5MZwpoJ7W4AjQQMg8bevnKcEgD5bwtAY9ZXMojMNtB LdhYeYTjwSLlO6gDStwcfb7I4e4ttEWeY9Bbrq0cWBDS7H2oLAF0sgeRG76gWB0dyQmb kPFJXP1mSBWB6/xk5aQkkBJi6eyzRZOZbxu5IOEOuyZXOUWVS5sZUpNpw9GUjkOPr0C+ Kw8lLXXF9uAyEuXS1tBf2qpD6KtGkSmDv3039FH1Kfs5r5D/gPxb1SNjJS91WOnVzxEy AR9VqtmZ/93Qn/kV7sPfd1QtWA1V7/A8IEQXnfQfj0MPqLW0kNJfdfvSP1K02bklfu0j 2pVQ== X-Gm-Message-State: AN3rC/5stOXYMhipVx8QqSPxV9mdqtbgQaPrEDmmBbnC2S7ATroxe9nM dGYdICu3qdaSPVTfQ0E= X-Received: by 10.107.12.167 with SMTP id 39mr13137228iom.28.1492728357759; Thu, 20 Apr 2017 15:45:57 -0700 (PDT) Received: from [192.168.1.154] ([216.160.245.98]) by smtp.gmail.com with ESMTPSA id r138sm297117ita.24.2017.04.20.15.45.56 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Apr 2017 15:45:57 -0700 (PDT) To: "linux-block@vger.kernel.org" From: Jens Axboe Subject: [PATCH] blk-mq-sched: add might_sleep() check for flush/fua insert Message-ID: Date: Thu, 20 Apr 2017 16:45:56 -0600 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 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 If we're doing a flush/fua insert, insertion might block on getting a driver tag, if can_block == true. Add a might_sleep check for that, since we just had a bug like that. This will help us catch a similar issue quicker in the future. Signed-off-by: Jens Axboe diff --git a/block/blk-mq-sched.c b/block/blk-mq-sched.c index 9e3c0f92851b..57aec8462e93 100644 --- a/block/blk-mq-sched.c +++ b/block/blk-mq-sched.c @@ -372,6 +372,7 @@ void blk_mq_sched_insert_request(struct request *rq, bool at_head, struct blk_mq_hw_ctx *hctx = blk_mq_map_queue(q, ctx->cpu); if (rq->tag == -1 && op_is_flush(rq->cmd_flags)) { + might_sleep_if(can_block); blk_mq_sched_insert_flush(hctx, rq, can_block); return; }