Re: Fix SWSUSP & !SWAP

Pavel Machek
2003-04-24T20:38:42Z

Hi!

> > > > > > > Sorry, I still don't get it. Go through the steps for me:
> > > > > > >
> > > > > > > 1) suspend writes pages to disk
> > > > > > >
> > > > > > > 2) machine is shutdown
> > > > > > >
> > > > > > > 3) restart, journal replay
> > > >
> > > > Corruption comes here. The journal reply tidies things up that shouldn't
> > > > be tidied up. They shouldn't be tidied up because once we reload the
> > > > image, things should be in the same state as prior to suspend. If replay
> > > > frees a block (thinking it wasn't properly linked or something similar),
> > > > it introduces corruption.
> > >
> > > No, this will not happen. All swapfile blocks must be allocated by swapon
> > > time. It is just a chunk of disk and replay will not touch it.
> > >
> > > That's for ext3, and no other filesystems journal data anyway...
> >
> > Its not about data.
> >
> > Corruption is not in suspended image. Imagine you have running system
> > (X open, applications running, gcc compiling) and someone runs journal
> > replay. Bye bye data. And that's what happens there. When you restore,
> > restored kernel no longer knows you did replay.
>
> Wouldn't that be true in all cases where you have a journaled filesystem
> and you suspend?

No. In normal state you restore without mounting anything (thus no
journal replay).

> Are you talking about someone restarting system (without
> doing a resume), mounting the file system (causing journal replay), and
> then shutting down and going back to the suspended image?

No, I'm not.

> I think the important thing to note is that if you don't unmount the
> filesystem during suspend, then no journal recovery will take place
> at resume time, because you are not really mounting the filesystem
> at all. And I can't see how you could be unmounting the filesystems
> without killing all of the applications, at which point it would make
> suspend pretty useless.

No, I'm not unmounting it.

> What is also important to note is that during normal filesystem operation,
> the ext3 journaling code never reads back any data from the journal, with
> the exception of a couple of fields in the journal superblock. I would
> hazard a guess that if you did a suspend, wiped the journal, and then
> resumed the journaling code wouldn't know the difference.

That's possible, but I do not want suspend to know about filesystem
specifics.

Pavel
--
When do you have a heart between your knees?
[Johanka's followup: and *two* hearts?]