lkml.org 
[lkml]   [2003]   [Apr]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Fix SWSUSP & !SWAP
On Sat, 2003-04-26 at 04:20, Andreas Dilger wrote:
> On Apr 25, 2003 14:59 +0200, Pavel Machek wrote:
> > > I don't believe Pavel was saying the image would be corrupted. Rather,
> > > the rest of the disk contents are corrupted by replaying the journal and
> > > then resuming back to a memory state that has been made inconsistent
> > > with the disk state because of the journal replay.
> >
> > Right.
>
> But that is happening regardless of whether a swapfile is in use or not.
> It is a problem whether the filesystem is journaling or not. Basically,
> if you are entering into a normal boot sequence and mounting filesystems
> and then resuming from your saved state you risk filesystem corruption.
>
> The only way to avoid that would be for the kernel to detect the swsusp
> magic data in the swap partition _before_ any filesystems are mounted
> (probably via initramfs), and then resume from that image (which will
> implicitly "mount" the filesystem because it was never unmounted in
> that image). Then, swsusp becomes a special case of the 2-kernel-monte
> (or add your other favourite kernel-booting-kernel method here), where
> most of your kernel state is swapped out and only a limited recovery
> state is loaded into RAM before doing the kernel dance).

And that's precisely what we do. SWSUSP runs before any file system is
mounted. It checks the designed partition's swap header, loads the image
and then completely replaces the booting kernel with the saved one.
That's how we avoid corruption at the moment. But if we have a swapfile,
we need to do some initialisation of the filesystem code in order to get
access to our swapfile. Even if we record in the swapfile - while
suspending - information that gives us the locations of blocks, we still
need to find the start of the swapfile, or store it somewhere. If you
have a suggestion in that regard, I might be able to see a swapfile as a
possibility.

Regards,

Nigel
--
Nigel Cunningham
495 St Georges Road South, Hastings 4201, New Zealand

Be diligent to present yourself approved to God as a workman who does
not need to be ashamed, handling accurately the word of truth.
-- 2 Timothy 2:14, NASB.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:35    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site