* [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined
@ 2011-11-23 3:13 Sujit Reddy Thumma
2011-11-23 8:55 ` Ulf Hansson
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Sujit Reddy Thumma @ 2011-11-23 3:13 UTC (permalink / raw)
To: linux-mmc, ulf.hansson; +Cc: Sujit Reddy Thumma, cjb
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>
---
Changes in v2:
- Addressed review comment from Ulf Hansson.
---
drivers/mmc/core/core.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 271efea..950b97d 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -2333,6 +2333,8 @@ int mmc_suspend_host(struct mmc_host *host)
mmc_poweroff_notify(host);
err = host->bus_ops->suspend(host);
}
+ mmc_do_release_host(host);
+
if (err == -ENOSYS || !host->bus_ops->resume) {
/*
* We simply "remove" the card in this case.
@@ -2347,7 +2349,6 @@ int mmc_suspend_host(struct mmc_host *host)
host->pm_flags = 0;
err = 0;
}
- 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.
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined
2011-11-23 3:13 [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined Sujit Reddy Thumma
@ 2011-11-23 8:55 ` Ulf Hansson
2011-11-24 10:17 ` Linus Walleij
2011-12-01 18:18 ` Chris Ball
2 siblings, 0 replies; 4+ messages in thread
From: Ulf Hansson @ 2011-11-23 8:55 UTC (permalink / raw)
To: Sujit Reddy Thumma; +Cc: linux-mmc@vger.kernel.org, cjb@laptop.org
Sujit Reddy Thumma wrote:
> 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>
>
Looks good to me!
Acked-by: Ulf Hansson <ulf.hansson@stericsson.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined
2011-11-23 3:13 [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined Sujit Reddy Thumma
2011-11-23 8:55 ` Ulf Hansson
@ 2011-11-24 10:17 ` Linus Walleij
2011-12-01 18:18 ` Chris Ball
2 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2011-11-24 10:17 UTC (permalink / raw)
To: Sujit Reddy Thumma; +Cc: linux-mmc, ulf.hansson, cjb
On Wed, Nov 23, 2011 at 4:13 AM, Sujit Reddy Thumma
<sthumma@codeaurora.org> wrote:
> 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>
Looks correct!
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined
2011-11-23 3:13 [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined Sujit Reddy Thumma
2011-11-23 8:55 ` Ulf Hansson
2011-11-24 10:17 ` Linus Walleij
@ 2011-12-01 18:18 ` Chris Ball
2 siblings, 0 replies; 4+ messages in thread
From: Chris Ball @ 2011-12-01 18:18 UTC (permalink / raw)
To: Sujit Reddy Thumma; +Cc: linux-mmc, ulf.hansson
Hi,
On Tue, Nov 22 2011, Sujit Reddy Thumma wrote:
> 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>
>
> ---
> Changes in v2:
> - Addressed review comment from Ulf Hansson.
> ---
> drivers/mmc/core/core.c | 3 ++-
> 1 files changed, 2 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 271efea..950b97d 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -2333,6 +2333,8 @@ int mmc_suspend_host(struct mmc_host *host)
> mmc_poweroff_notify(host);
> err = host->bus_ops->suspend(host);
> }
> + mmc_do_release_host(host);
> +
> if (err == -ENOSYS || !host->bus_ops->resume) {
> /*
> * We simply "remove" the card in this case.
> @@ -2347,7 +2349,6 @@ int mmc_suspend_host(struct mmc_host *host)
> host->pm_flags = 0;
> err = 0;
> }
> - mmc_do_release_host(host);
> } else {
> err = -EBUSY;
> }
Thanks very much, pushed to mmc-next for 3.2 with ACKs from Ulf and Linus.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-12-01 18:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-23 3:13 [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined Sujit Reddy Thumma
2011-11-23 8:55 ` Ulf Hansson
2011-11-24 10:17 ` Linus Walleij
2011-12-01 18:18 ` Chris Ball
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox