Re: [PATCH] mmc: add module parameter to set whether cards are assumed removable

Ben Hutchings
2009-11-16T22:31:49Z

[-- Attachment #1: Type: text/plain, Size: 2300 bytes --]

On Mon, 2009-11-16 at 12:23 -0800, Andrew Morton wrote:
> On Wed, 11 Nov 2009 04:44:36 +0000
> Ben Hutchings <ben@decadent.org.uk> wrote:
>
> > 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.
> >
>
> The description really doesn't give me enough info to work out what's
> happening here and why this is being proposed. But it smells nasty.

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.

[...]
> > diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> > index d98b0e2..010c964 100644
> > --- a/drivers/mmc/core/core.c
> > +++ b/drivers/mmc/core/core.c
> > @@ -48,6 +48,22 @@ int use_spi_crc = 1;
> > module_param(use_spi_crc, bool, 0);
> >
> > /*
> > + * We normally treat cards as removed during suspend if they are not
> > + * known to be on a non-removable bus, to avoid the risk of writing
> > + * back data to a different card after resume. Allow this to be
> > + * overridden if necessary.
> > + */
>
> So we have a module parameter which nobody knows about. If they don't
> set this parameter which they don't know about, the kernel will trash
> their filesystem??
[...]

No, because it's set to 1 by default. There is no change in the default
behaviour.

Ben.

--
Ben Hutchings
The two most common things in the universe are hydrogen and stupidity.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 828 bytes --]