From: Maxim Levitsky <maximlevitsky@gmail.com>
To: linux-mmc@vger.kernel.org
Cc: Philip Langdale <philipl@overt.org>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel <linux-kernel@vger.kernel.org>,
Maxim Levitsky <maximlevitsky@gmail.com>
Subject: [PATCH] MMC: fix hang if card was removed during suspend and unsafe resume was enabled
Date: Fri, 5 Feb 2010 01:18:15 +0200 [thread overview]
Message-ID: <1265325495-4220-1-git-send-email-maximlevitsky@gmail.com> (raw)
In-Reply-To: <1265219241.12549.8.camel@maxim-laptop>
Currently removal of the card leads to del_disk called indirectly by mmc core.
This function expects userspace to be running, which isn't when .resume is called
Fix that by removing the code that did that in mmc_resume_host. It is possible
because card detection logic will kick it later and remove the card.
Also make mtd workqueue freezeable, so it won't attempt to add/remove the card
while userspace is frozen.
Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com>
---
drivers/mmc/core/core.c | 9 ++-------
1 files changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 30acd52..879d48d 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -1257,7 +1257,6 @@ int mmc_suspend_host(struct mmc_host *host, pm_message_t state)
if (host->caps & MMC_CAP_DISABLE)
cancel_delayed_work(&host->disable);
cancel_delayed_work(&host->detect);
- mmc_flush_scheduled_work();
mmc_bus_get(host);
if (host->bus_ops && !host->bus_dead) {
@@ -1300,15 +1299,11 @@ int mmc_resume_host(struct mmc_host *host)
mmc_select_voltage(host, host->ocr);
BUG_ON(!host->bus_ops->resume);
err = host->bus_ops->resume(host);
+
if (err) {
printk(KERN_WARNING "%s: error %d during resume "
"(card was removed?)\n",
mmc_hostname(host), err);
- if (host->bus_ops->remove)
- host->bus_ops->remove(host);
- mmc_claim_host(host);
- mmc_detach_bus(host);
- mmc_release_host(host);
/* no need to bother upper layers */
err = 0;
}
@@ -1332,7 +1327,7 @@ static int __init mmc_init(void)
{
int ret;
- workqueue = create_singlethread_workqueue("kmmcd");
+ workqueue = create_freezeable_workqueue("kmmcd");
if (!workqueue)
return -ENOMEM;
--
1.6.3.3
next prev parent reply other threads:[~2010-02-04 23:18 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-03 17:47 Hand on resume if sd/mmc card was removed while system was suspended/hibernated Maxim Levitsky
2010-02-04 23:18 ` Maxim Levitsky [this message]
2010-02-05 0:09 ` [PATCH] MMC: fix hang if card was removed during suspend and unsafe resume was enabled Andrew Morton
2010-02-05 8:31 ` Maxim Levitsky
2010-02-05 14:13 ` Andrew Morton
2010-02-05 14:19 ` Maxim Levitsky
2010-02-05 14:39 ` Andrew Morton
2010-02-05 15:52 ` Maxim Levitsky
2010-02-05 16:19 ` Madhusudhan
2010-02-05 16:32 ` Maxim Levitsky
2010-02-05 18:26 ` Andrew Morton
2010-02-05 19:58 ` Maxim Levitsky
2010-02-05 10:17 ` Adrian Hunter
2010-02-05 13:42 ` Maxim Levitsky
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=1265325495-4220-1-git-send-email-maximlevitsky@gmail.com \
--to=maximlevitsky@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=philipl@overt.org \
/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;
as well as URLs for NNTP newsgroup(s).