Subject: Re: unsynced vnd images
To: Florian Stoehr <netbsd@wolfnode.de>
From: Greg Troxel <gdt@ir.bbn.com>
List: netbsd-users
Date: 02/18/2005 10:53:16
  I thought the system would track which buffers need syncing and use
  the in-cache version if accessing a not-yet-written file? This does
  *NOT* work, at least not in the following case:

  disk.img -> vnd -> cgd -> /mnt

I'd guess that when accessing via an abstraction that uses the buffer
cache things rae ok.  If you look in /mnt, the file is there.  There
are probably dirty buffers that have not yet been written to the
cgd-provided virtual disk.  Softupdates, or regular ffs behavior, will
be in effect in the /mnt fs. 

I don't know how cgd behaves about caching.  In order to make
softupdates work correctly it probably has to ensure that the
underlying disk operation has completed before claiming that the write
it does is done.  And same for vnd, which would mean fsync I think.

You may be able to do a downgrade of the fs to readonly.  I saw some
messages earlier indicating that this might not ensure the cache is
flushed, but IMHO it is a bug if the change to RO returns before all
dirty blocks have hit disk.

There is still the issue of ensuring the file disk.img is consistent
when cgd reports writes as done.  I suspect that's ok, even if the
bits on disk aren't quite there yet, and it seems that since you want
to copy the file that's what counts for you.

-- 
        Greg Troxel <gdt@ir.bbn.com>