Subject: Re: how to bring a mounted filesystem to an almost clean state?
To: Christian Limpach <>
From: Perry E. Metzger <>
List: tech-kern
Date: 02/15/2003 23:25:59
I find myself wanting to do this for a different reason -- I want to
assure on system sleep (think APM or ACPI suspends) that all file
systems are synced cleanly.

I have some ideas myself on how to add some stuff to do this, but I
must confess they all look ugly...


Christian Limpach <> writes:

> I'm looking for advice on how to bring a mounted filesystem to an almost 
> clean state.  I have a device driver which lets me take a snapshot at the 
> blockdevice level and doing this to a mounted filesystem I get a snapshot 
> which is in a more or less clean state.
> I've tried VFS_SYNC with ~MNT_ASYNC, like in sys_sync.  This helps somewhat 
> but there's inconsistencies when there's activity on the filesystem, a few on 
> plain ffs filesystems and a lot on softdep ffs filesystems.  It seems to me 
> like I'd need some way to block vn_write's on the filesystem until I have 
> sync'ed the filesystem and taken the snapshot.  There doesn't seem to be a 
> per filesystem lock to block all (write-)io, maybe there should be?  I'm 
> going to try to vn_lock all the vnodes on the filesystem and then sync.  Is 
> this the best solution or are there other options?
> -- 
> Christian Limpach <>

Perry E. Metzger