Subject: how to bring a mounted filesystem to an almost clean state?
To: None <tech-kern@NetBSD.ORG>
From: Christian Limpach <chris@pin.lu>
List: tech-kern
Date: 02/14/2003 16:48:01
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 <chris@pin.lu>