From owner-freebsd-current Tue Dec 17 12:24:49 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id MAA16525 for current-outgoing; Tue, 17 Dec 1996 12:24:49 -0800 (PST) Received: from phaeton.artisoft.com (phaeton.Artisoft.COM [198.17.250.211]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id MAA16436 for ; Tue, 17 Dec 1996 12:23:45 -0800 (PST) Received: (from terry@localhost) by phaeton.artisoft.com (8.6.11/8.6.9) id NAA08756; Tue, 17 Dec 1996 13:20:40 -0700 From: Terry Lambert Message-Id: <199612172020.NAA08756@phaeton.artisoft.com> Subject: Re: Warning -- Lite/2 merge coming up To: jonny@mailhost.coppe.ufrj.br (Joao Carlos Mendes Luis) Date: Tue, 17 Dec 1996 13:20:40 -0700 (MST) Cc: mark@grondar.za, toor@dyson.iquest.net, current@freebsd.org In-Reply-To: <199612170140.XAA02665@gaia.coppe.ufrj.br> from "Joao Carlos Mendes Luis" at Dec 16, 96 11:40:30 pm X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk > > > What about the other broken FS's, like union and null? > > > > > We have been holding off until the Lite/2 merge. Lite/2 might fix > > some of the problems. > > Sometime ago I was reading the unionfs algorithm on the 4.4 BSD book. > One problem that came to my mind was about the deleted files. > > It says that if one file on the lower layer is deleted, as it shall not > be really deleted, an entry on the upper layer directory is created with > the I-node 1. I believe you are confusing "whiteout" and "delete". The way it *should* behave is as a preemptive negative cache hit, assuming you are using the union FS as a translucent FS... ie: changes to the top level media look like changes to the agregate media even if the agregate media is read-only -- for instance, a CVS update of a CDROM source tree. By preemptive, it means that it returns "not found", and the search is not continued for the unioned media. But if you create the file, then it is deleted, but is pretended to be not found, so that it gets a valid inode allocated for it. For all intents and purposes, then, it's a special entry in a directory seperate from an allocated inode for a directory, which causes the search to exit prematurely until it is removed or replaced. As an overlay FS simply mounted instead of union mounted, the file will not show up; this is because inode 1 is historically reserved as a file entry marker for the bad block list on the drive. Note that this "whiteout" function requires that the FS support two ideas: (1) The directory entry and the inode are seperate things; this means it won't work for MSDOSFS, since in a FAT FS, the drictory entry *is* the on disk inode. (2) The FS type understands the historical reservation of inode 1 (ie: it won't work on ISO9660FS, but who cares, since it's read-only). > And, the final problem: When making a copy from lower to upper layer > (to permit a write access to some file) should this be done by the > kernel ? Is it a good approach ? This could mean a very large > operation, and I don't like to keep the kernel busy for such a long > time. Maybe a daemon implementation (just like portal) should do > this job better. You should use "copy to self". The first lookup for the target for read will get a lower FS entry; the second open for the write will get an upper FS entry by virtue of the open-for-write attribute. This is the one case where "cp foo foo" is meaningful and should not be trapped by the user space tools, but by the underlying FS instead. Terry Lambert terry@lambert.org --- Any opinions in this posting are my own and not those of my present or previous employers.