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: 137388 Delivered-To: patch@linaro.org Received: by 2002:a2e:9706:0:0:0:0:0 with SMTP id r6-v6csp6599886lji; Thu, 31 May 2018 06:23:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJrw6WbN91/2/retkzS+AhqkBClD18MiAdyNimVIbfnjqV5Ff5RcnYCZIyPzPvX7Cgzb7Mc X-Received: by 2002:a62:1083:: with SMTP id 3-v6mr6798354pfq.229.1527773023502; Thu, 31 May 2018 06:23:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527773023; cv=none; d=google.com; s=arc-20160816; b=LBMAbUFQFS81wV5YrbVHzWwS+OeUjsKxWqwCvAQxwtlF6KgvieyEhUwXjX+aJO0oRc BYsezMHl4E38kEZrjS59GrnJoOQalHQVoePjTGrVJg63HNrHVcWVKmooFSGcDzebLbRT tOn+/PGZdMvRLkImwezV9vf+dF0w5J0IwwPWAWs6HjzwDa4RVhsLGB8sHOucleGpOATH IaqumssRHJv6PZZN59FZMGVTEhq0YNxqoax6UoHUpm2qKEagA1i6ZettNWBbzzTdd2Wb om41IEuAGmx4evSYlDavW/72O8uv33HQpzcAnbxKjWeKWeugBjGw0T7W5HsPqhVEcX3R XlbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=PoqjbBYW1Eiq6YTf8CzxmL3H/N7hXTcZfnLA2waIqAQ=; b=gi8tWCW2SHu9jI3hr5mvufaGDj8ArCaOaVCwmA/TjfJ+WeZRLFczx6gs5aChe7OWj0 AOr69ttpWqHPFfVECkPpw9yz+wCWGutVtxASl1e6Z7R6M6iwGka4LaPjdIA5HjL8hZiv 1jZSKorLDNveriVMpWs80yQM+X9bePVnUw/OVqg2dS9YD7Pk7PQg7ioWoq7//bIXIaP5 a0nRCY/AKwXzUUQSkeVnl5E8o5VFk5yavvMUuPxno/p94cYoxNYgQorlNKXZUISb92NI jpfNb9SMI8KowCqJonQGQEJW/fPTcXe5VJ1ENnt4LipiUZuPpoiHh0MYdgvwpc439eH3 gUEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D/d9jfzE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r17-v6si17558609pls.597.2018.05.31.06.23.43; Thu, 31 May 2018 06:23:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=D/d9jfzE; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755291AbeEaNXk (ORCPT + 30 others); Thu, 31 May 2018 09:23:40 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:40940 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755159AbeEaNXf (ORCPT ); Thu, 31 May 2018 09:23:35 -0400 Received: by mail-wr0-f196.google.com with SMTP id l41-v6so33047084wre.7 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=Ajifsv70TTiXlQ2G5owhITZEfDFTN/ZA+3IOubqyPYz3JfhZVkl3ORawnYI85vgVZW C8vmI85sD1ZX8QPwLfoMSq6G4sKDxTwEdzHncC+wEama1K8Dx3c0LK5KLpC8oZ1w8TNQ LqvztBPKD3NZ5JGo2GYBGYVQDrJm5/RNnyvFfWALbJ0pefYLvl/8P+lcjygkdKCPSBK9 65PJWDGzl9GIK2AHwJIBPQ8iCjTDjhnmWuVfQxHjLPb58WlsPFQS3QeHyRGAq0YTVrMW eD4IdVgSY2svrhCsQd8N+fb/6mPEsZpB/0OEc8d1/aMjMfu8Of2t9Jt4g8sabxuBfgvq MqLA== X-Gm-Message-State: ALKqPwfDlBVJCrW6DhFyvniz6cNz4G0Ci0FR36sWTFLBKkz8u+eRqaM6 q3jvgijNH6wO+GZGbamArIKjWw== 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-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) -- 2.16.1 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); }