Subject: Re: FFS journal
To: None <tech-kern@NetBSD.org>
From: Pavel Cahyna <pavel@NetBSD.org>
Date: 07/04/2006 23:48:33
On Tue, Jul 04, 2006 at 03:32:36PM -0400, der Mouse wrote:
> >>> This one could be solved by deleting the file on disk when the
> >>> filesystem is made read-only, I think.
> >> That will [...] not, however, preserve the long-standing Unix
> >> semantics of continuing to use open-but-unlinked files.
> > Why couldn't the file continue to be used, even if it is deleted on
> > disk? Remember, the filesystem is now RO, so nothing can reuse the
> > freed data and metadata for another purpose.
> This depends on the filesystem, of course.
> For FFS, I think this would work: the inode is cleared, but the inode
> is locked in core anyway while the file is open - and the data and
> indirect blocks will be marked free but, as you say, their contents
> will be undisturbed.
> I don't know other filesystems enough to speak to them.
> However, even for FFS, it will break if you switch from RW to RO and
> then back to RW.
If we ever want to support this properly, the kernel should remember
that a cleared inode is still used, and when doing the switch back to RW
undelete the inode using the cached data.