From: Sujit Reddy Thumma <sthumma@codeaurora.org>
To: linux-mmc@vger.kernel.org, ulf.hansson@stericsson.com
Cc: Sujit Reddy Thumma <sthumma@codeaurora.org>, cjb@laptop.org
Subject: [PATCH] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined
Date: Tue, 22 Nov 2011 17:00:37 +0530 [thread overview]
Message-ID: <1321961437-27130-1-git-send-email-sthumma@codeaurora.org> (raw)
mmc_suspend_host() tries to claim host during suspend
and release it only when the bus suspend operation is
compeleted. If CONFIG_MMC_UNSAFE_RESUME is defined and
the host is flagged as removable, mmc_suspend_host()
tries to remove the card. In this process, the file system
sync can get blocked trying to acquire host which is already
claimed by mmc_suspend_host() causing deadlock.
Fix this deadlock by releasing host before ->remove() is called.
Signed-off-by: Sujit Reddy Thumma <sthumma@codeaurora.org>
---
drivers/mmc/core/core.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 271efea..8adbadf 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2338,6 +2338,7 @@ int mmc_suspend_host(struct mmc_host *host)
* We simply "remove" the card in this case.
* It will be redetected on resume.
*/
+ mmc_do_release_host(host);
if (host->bus_ops->remove)
host->bus_ops->remove(host);
mmc_claim_host(host);
@@ -2346,8 +2347,9 @@ int mmc_suspend_host(struct mmc_host *host)
mmc_release_host(host);
host->pm_flags = 0;
err = 0;
+ } else {
+ mmc_do_release_host(host);
}
- mmc_do_release_host(host);
} else {
err = -EBUSY;
}
--
Sent by a consultant of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.
next reply other threads:[~2011-11-22 11:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-22 11:30 Sujit Reddy Thumma [this message]
2011-11-22 15:43 ` [PATCH] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined Ulf Hansson
2011-11-23 3:13 ` Sujit Reddy Thumma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1321961437-27130-1-git-send-email-sthumma@codeaurora.org \
--to=sthumma@codeaurora.org \
--cc=cjb@laptop.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ulf.hansson@stericsson.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox