lkml.org 
[lkml]   [2009]   [Nov]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] mmc: add module parameter to set whether cards are assumed removable
From
Date
On Mon, 2009-11-30 at 13:39 +0100, Pierre Ossman wrote: 
> On Tue, 17 Nov 2009 08:53:00 +0100
> Stefan Richter <stefanr@s5r6.in-berlin.de> wrote:
>
> > Ben Hutchings wrote:
> > > 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.
> >
> > That's true for virtually all storage devices, not just MMC.
> >
> > > 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.
> >
> > Can't the kernel flush the write buffer at suspend time, so that you can
> > remove this choice for good?
>
> I'm afraid that's insufficient. What it would need to do is to is
> flush everything (to make sure what's on disk matches what's in
> memory), but also read back the filesystem on resume to verify that
> nothing else modified it (i.e. making sure what's on disk still matches
> what's in memory).

I had just an idea.

Before we do suspend, pick few random sectors from the media, run that
through some hash function, thus creating some sort of watermark.

On resume do that again.

This should catch all unintentional card swappings.

Of course this is only half of the problem, because user could edit the
card meanwhile, but still solving half the problem is better that
nothing?


What do you think ?

Best regards,
Maxim Levitsky



\
 
 \ /
  Last update: 2009-11-30 14:35    [W:1.785 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site