From patchwork Tue Feb 27 11:22:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 10244803 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 0833460362 for ; Tue, 27 Feb 2018 11:22:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F29271FF41 for ; Tue, 27 Feb 2018 11:22:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E6DD3201A4; Tue, 27 Feb 2018 11:22:40 +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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 5BAB41FF41 for ; Tue, 27 Feb 2018 11:22:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752300AbeB0LWj (ORCPT ); Tue, 27 Feb 2018 06:22:39 -0500 Received: from mail-lf0-f68.google.com ([209.85.215.68]:39539 "EHLO mail-lf0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751956AbeB0LWj (ORCPT ); Tue, 27 Feb 2018 06:22:39 -0500 Received: by mail-lf0-f68.google.com with SMTP id f75so21928715lfg.6 for ; Tue, 27 Feb 2018 03:22:38 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=0TCSYXa9Dkykv16P2C9AL9DSyaK3D4C3zgiVeQ7OgwU=; b=PTTYYeHrJuOE+CQ292hePYfkGRDiPUuxOlDnYMDejvVQBHDK/o3trZ8jj6J8yPQLFb 4nnmuz95A8zAktefCC11Bnrg6Wj7Jc2AFqQWE8/3pmzKWuwwFmjTYr4MlTBfmJWrIBLt nsJx9ydV+bsIHh5JJb/LRst6JrwIPID6M6BaQ= 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; bh=0TCSYXa9Dkykv16P2C9AL9DSyaK3D4C3zgiVeQ7OgwU=; b=NZJqxZSXLqCvz9PCZWGKz1R1G9sG6EQZr+Q00Mpx3wk7iP2DDdjsiCbtYvHQPY7qE0 gZXJEFlC6NXHFgTu0SNlYgjQjvgNkUWhWNqGruOJ9NazQGo2x/2h66X72ph1uMp5KMia ybmGAHjIaXlce1aaJNkG0coBSYgAKoXGhfZkWxJkwhT9hzxzeuoI5uoOUKDuHRdI/pHV /RabRg91XfEqIZjOJDkysdrku2WIcRtg9MRsdAdGu7ucjvnSrIe3lCiCASi6iM8erJ0z YSkyoEvuK8jOZgnSbAULAvMUFR6+qyd2ucc/g3TrDYa9cbMDP1FEendwSc+AXxL2an26 114w== X-Gm-Message-State: APf1xPCUTv6vAko2rge8QhVJYeD+AhV3Yxmxd72f8KVj8DruX8FkNZ5o zUJiRe6P7KI5obREErebut7W0lzy6Qw= X-Google-Smtp-Source: AG47ELsZufPyqIWb1JP7uWsJB1eTqzwhKParFBWczeIko5r7oq11bdI3FzCTluqptM/4y0Grt+Wqwg== X-Received: by 10.46.145.72 with SMTP id q8mr10095261ljg.108.1519730557395; Tue, 27 Feb 2018 03:22:37 -0800 (PST) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b82sm2506750lfl.9.2018.02.27.03.22.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 27 Feb 2018 03:22:36 -0800 (PST) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Adrian Hunter , Linus Walleij Cc: Ulf Hansson , Dmitry Osipenko Subject: [PATCH] mmc: core: Avoid hanging to claim host for mmc via some nested calls Date: Tue, 27 Feb 2018 12:22:15 +0100 Message-Id: <1519730535-9991-1-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP As the block layer, since the conversion to blkmq, claims the host using a context, a following nested call to mmc_claim_host(), which isn't using a context, may hang. Calling mmc_interrupt_hpi() and mmc_read_bkops_status() via the mmc block layer, may suffer from this problem, as these functions are calling mmc_claim|release_host(). Let's fix the problem by removing the calls to mmc_claim|release_host() from the above mentioned functions and instead make the callers responsible of claiming/releasing the host. As a matter of fact, the existing callers already deals with it. Fixes: 81196976ed94 ("mmc: block: Add blk-mq support") Reported-by: Dmitry Osipenko Suggested-by: Adrian Hunter Tested-by: Dmitry Osipenko Signed-off-by: Ulf Hansson Acked-by: Adrian Hunter Reviewed-by: Shawn Lin --- drivers/mmc/core/mmc_ops.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 908e4db..42d6aa8 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -848,7 +848,6 @@ int mmc_interrupt_hpi(struct mmc_card *card) return 1; } - mmc_claim_host(card->host); err = mmc_send_status(card, &status); if (err) { pr_err("%s: Get card status fail\n", mmc_hostname(card->host)); @@ -890,7 +889,6 @@ int mmc_interrupt_hpi(struct mmc_card *card) } while (!err); out: - mmc_release_host(card->host); return err; } @@ -932,9 +930,7 @@ static int mmc_read_bkops_status(struct mmc_card *card) int err; u8 *ext_csd; - mmc_claim_host(card->host); err = mmc_get_ext_csd(card, &ext_csd); - mmc_release_host(card->host); if (err) return err;