[Lucid] SRU: Allow mmc cards to be used with unsafe resume

Stefan Bader stefan.bader at canonical.com
Mon Apr 5 15:47:34 UTC 2010


Leann Ogasawara wrote:
> On Sat, 2010-04-03 at 11:50 +0200, Stefan Bader wrote:
>> SRU Justification:
>>
>> Impact: On suspend, mmc cards are ejected on suspend and rediscovered at
>> resume. There seems to be a bug in that in Lucid as a mounted mmc card
>> causes the suspend to hang. Also ejecting and rediscovering is actually
>> annoying if the card contains extensions to the home directory or a root
>> filesystem.
>>
>> Fix: This is not a real fix, but a workaround. In the Lucid code there is
>> a compile time only option to allow the mmc/sd card to be mounted and just
>> get reused on resume. Contrary to the unsafe title there arctually is some
>> safeguarding code to check the cards id before blindly using it.
>> The following patch leaves the default as it is now, but allows users to
>> change the mode with a boot parameter or by writing into the modules parameter
>> in sysfs.
>>
>> Testcase: Suspend with mounted SD card hangs on its way down. With removable=0
>> it will go down and come up without apparent problems.
>>
>>
>> From faf4b61efc07ba61195e97b42200331aea030b0d Mon Sep 17 00:00:00 2001
>> From: Ben Hutchings <ben at decadent.org.uk>
>> Date: Mon, 14 Dec 2009 18:01:29 -0800
>> Subject: [PATCH] mmc: add module parameter to set whether cards are assumed removable
>>
>> Some people run general-purpose distribution kernels on netbooks with
>> a card that is physically non-removable or logically non-removable
>> (e.g. used for /home) and cannot be cleanly unmounted during suspend.
>> Add a module parameter to set whether cards are assumed removable or
>> non-removable, with the default set by CONFIG_MMC_UNSAFE_RESUME.
>>
>> In general, it is not possible to tell whether a card present in an MMC
>> slot after resume is the same that was there before suspend.  So there are
>> two possible behaviours, each of which will cause data loss in some cases:
>>
>> CONFIG_MMC_UNSAFE_RESUME=n (default): Cards are assumed to be removed
>> during suspend.  Any filesystem on them must be unmounted before suspend;
>> otherwise, buffered writes will be lost.
>>
>> CONFIG_MMC_UNSAFE_RESUME=y: Cards are assumed to remain present during
>> suspend.  They must not be swapped during suspend; otherwise, buffered
>> writes will be flushed to the wrong card.
>>
>> Currently the choice is made at compile time and this allows that to be
>> overridden at module load time.
>>
>> BugLink: http://bugs.launchpad.net/bugs/477106
>>
>> Signed-off-by: Ben Hutchings <ben at decadent.org.uk>
>> Cc: Wouter van Heyst <larstiq at larstiq.dyndns.org>
>> Cc: <linux-mmc at vger.kernel.org>
>> Signed-off-by: Andrew Morton <akpm at linux-foundation.org>
>> Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
>> (cherry-picked from commit bd68e0838fe85794b06892054772fa013a8d1986 upstream)
>> Signed-off-by: Stefan Bader <stefan.bader at canonical.com>
> 
> Looks ok to me.  Stefan, will you be building test kernels for bug
> 477106?
> 
Ah, actually I have but only (selfishly) for myself and only for i386. But I
will let it build on ronne and shove over the kernels tomorrow.
[As my Aspire One exactly shows that hang I can at least confirm it seems to
work for me :)]

Stefan




More information about the kernel-team mailing list