Re: Fix SWSUSP & !SWAP

Andreas Dilger
2003-04-25T04:17:16Z

On Apr 24, 2003 18:22 -0700, H. Peter Anvin wrote:
> By author: Geert Uytterhoeven <geert@linux-m68k.org>
> > This has nothing to do with using a swapfile.
> >
> > But if you resume from swsusp, you don't really `mount' all file systems.
> > They are implicitly mounted because they were mounted before the suspend
> > operation.
>
> Shouldn't we be syncing them all before the suspend anyway, to
> minimize corruption in case the user chooses to mount the filesystem
> *without* resuming (think a dual-boot configuration.) This would be
> another application for the "supersync" operation that was discussed
> at OLS 2002 -- a need for an operation which not only flushes all
> blocks to disk but also forces the journal to be replayed and
> truncated.

This "supersync" already exists, and it is supported by all of the
journaling filesystems for LVM snapshots. This is the VFS method
write_super_lockfs in the ext3/reiserfs/XFS/JFS super_operations.
Not only does it sync the dirty data to disk, but it also forces
the journal to be empty and marks the filesystem clean, so that it
can be snapshotted and read-only mounted (basically equivalent to
unmounting the filesystem).

Unfortunately, even though the filesystems themselves have supported
this VFS method for a long time, the actual code that calls these
methods (sync_super_lockfs() and unlockfs()) are still only available
as a patch from LVM. The LVM/reiserfs folks have talked about submitting
it to Marcelo for a long time now, but apparently still haven't done so.

Cheers, Andreas
--
Andreas Dilger