From patchwork Thu May 31 13:23:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Valente X-Patchwork-Id: 10441095 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 B004D603B5 for ; Thu, 31 May 2018 13:24:17 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9776829366 for ; Thu, 31 May 2018 13:24:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9578F29669; Thu, 31 May 2018 13:24:17 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable 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 2AD7E29519 for ; Thu, 31 May 2018 13:24:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755270AbeEaNXi (ORCPT ); Thu, 31 May 2018 09:23:38 -0400 Received: from mail-wr0-f193.google.com ([209.85.128.193]:36520 "EHLO mail-wr0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755265AbeEaNXf (ORCPT ); Thu, 31 May 2018 09:23:35 -0400 Received: by mail-wr0-f193.google.com with SMTP id f16-v6so17679902wrm.3 for ; Thu, 31 May 2018 06:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=PoqjbBYW1Eiq6YTf8CzxmL3H/N7hXTcZfnLA2waIqAQ=; b=D/d9jfzEs1AkewG3qYsCo02M6AkabcFZjfpw2gd8fNLEruK6oHRGwgu8gu6mXotQcz jaTUJSEtivjoEjggSuVgMvqgLF35ATqpiFZsnxCY0bUbs8bqoYNsNZvFLXvYW7GGsP12 hHDmfcMxgisg2U3XZ9/0SiVD46rC02MnblgXk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=PoqjbBYW1Eiq6YTf8CzxmL3H/N7hXTcZfnLA2waIqAQ=; b=Z1y0TZthCvKCPFBXixJppoe8N+Sxxe8G5Zpjoy+5EHfVKWpXnRdrarTLvh1e4/p/72 /MUf2/vPeL2b3IQCQsGbZKVBjrzBRwEcr9yKpKrn82i88MRmHGjKrI+/bwQQLxpFNeB5 jq+1/VT3WzE5klddhsaJp7AHdtAQyD2g2Z1RrwojBPVdaJavioQ/K1lHntnZTRTS+WSA 6bf4/QgM8wM5Bu+3teq3rwByM8vcuc8RfYQbNYzUuUM1S8Tlcs1Z3bgYkB+cc0G1HaJ6 7RcyrLpXjBYSLpJgotYsh/Uow76XEkq5bS2NT8Fk/2190W5VHJi2Vaj9Z4lHzduvOdMZ Vnng== X-Gm-Message-State: ALKqPwcl94Oc8wdD3iON4/+77KTtWszogEPgTFqeYuXY6YAWtEZIoLDs rt2KN3fPSOyo3/pLcxfB+mJB1Q== X-Google-Smtp-Source: ADUXVKIQn2Oo0GtGLDJKxempJFD+5lK/oysstKxV64LaVe/YuMq7ifkL2b5CisFzWvMcBom4jbg0aQ== X-Received: by 2002:a5d:408f:: with SMTP id o15-v6mr4921225wrp.133.1527773013252; Thu, 31 May 2018 06:23:33 -0700 (PDT) Received: from localhost.localdomain (146-241-12-84.dyn.eolo.it. [146.241.12.84]) by smtp.gmail.com with ESMTPSA id e133-v6sm1759478wma.38.2018.05.31.06.23.31 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 May 2018 06:23:31 -0700 (PDT) From: Paolo Valente To: Jens Axboe Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, ulf.hansson@linaro.org, broonie@kernel.org, linus.walleij@linaro.org, bfq-iosched@googlegroups.com, oleksandr@natalenko.name, filippo.muzzini@outlook.it, Paolo Valente Subject: [PATCH BUGFIX 1/3] block, bfq: remove wrong lock in bfq_requests_merged Date: Thu, 31 May 2018 15:23:11 +0200 Message-Id: <20180531132313.2986-2-paolo.valente@linaro.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180531132313.2986-1-paolo.valente@linaro.org> References: <20180531132313.2986-1-paolo.valente@linaro.org> 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 From: Filippo Muzzini In bfq_requests_merged(), there is a deadlock because the lock on bfqq->bfqd->lock is held by the calling function, but the code of this function tries to grab the lock again. This deadlock is currently hidden by another bug (fixed by next commit for this source file), which causes the body of bfq_requests_merged() to be never executed. This commit removes the deadlock by removing the lock/unlock pair. Signed-off-by: Filippo Muzzini Signed-off-by: Paolo Valente --- block/bfq-iosched.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/block/bfq-iosched.c b/block/bfq-iosched.c index 771ae9730ac6..1f0951d36424 100644 --- a/block/bfq-iosched.c +++ b/block/bfq-iosched.c @@ -1898,7 +1898,6 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, if (!RB_EMPTY_NODE(&rq->rb_node)) goto end; - spin_lock_irq(&bfqq->bfqd->lock); /* * If next and rq belong to the same bfq_queue and next is older @@ -1923,7 +1922,6 @@ static void bfq_requests_merged(struct request_queue *q, struct request *rq, bfq_remove_request(q, next); bfqg_stats_update_io_remove(bfqq_group(bfqq), next->cmd_flags); - spin_unlock_irq(&bfqq->bfqd->lock); end: bfqg_stats_update_io_merged(bfqq_group(bfqq), next->cmd_flags); }