Subject: kern/8183: unionfs: delay creation of shadow directories
To: None <email@example.com>
From: None <firstname.lastname@example.org>
Date: 08/09/1999 21:35:48
>Synopsis: unionfs: delay creation of shadow directories
>Responsible: kern-bug-people (Kernel Bug People)
>Arrival-Date: Mon Aug 9 21:35:01 1999
>Originator: Bill Sommerfeld
System: NetBSD heap.epilogue.com 1.4 NetBSD 1.4 (HEAPII) #72: Sun Jul 4 00:38:40 EDT 1999 wes@:/usr/sommerfeld/NetBSD-sys/arch/i386/compile/HEAPII i386
unionfs creates shadow directories in the upper
layer of the union whenever a lookup happens into a directory
which doesn't exist in the upper layer.
this occurs even if the union is mounted read-only; a find(1)
in a union mount with a mostly-empty upper layer still creates
lots of empty directories.
mount -o ro -t union /tmp/xxx /usr/src
find /usr/src -type d -print >/dev/null
ls -R /tmp/xxx
defer creation of shadow directories; just leave the upper
layer NULL in the union vnode until something gets put in
when something gets created in a directory with a null upper
layer, scan upward in the union vnode directories until you
reach a union vnode which does have an upper-layer directory,
then use the framework for getcwd(2) between those two nodes
to figure out the correct pathnames of directories to create
in the upper layer.
this is likely to be vnode locking minefield.
getting it right in the presence of directory renames in the
lower layer is likely to be a PITA.