Re: [PATCH V2] mmc: core: Fix deadlock when the CONFIG_MMC_UNSAFE_RESUME is not defined

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
>
> ---
> 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@xxxxxxxxxx>   <http://printf.net/>
One Laptop Per Child
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux