Subject: FS layering bug?
To: NetBSD tech-kern <tech-kern@netbsd.org>
From: Marton Fabo <morton@eik.bme.hu>
List: tech-kern
Date: 01/26/2004 00:59:52
Hello!

I have a 1.6ZC i386 system from some last october -current source, with 
the default FS layout of / and /usr as two FSes.

I have tried the following: I copied all the contents of the / 
filesystem to /var/tmp/chroot, then I null-mounted /usr on 
/var/tmp/chroot/usr read-only, and then I union-mounted an empty 
/var/tmp/chroot/chroot-usr directory over /var/tmp/chroot/usr. This is 
so that I have a full writeable replica of my system in /var/tmp/chroot, 
with only having to duplicate the contents of the root FS.

Now I chrooted to the above dir, started to play around, everything 
worked like a charm, I could modify it without endangering anything in 
my real system. But after some time, the kernel panicked with the 
message "locking against myself".

The question is whether 1) this is an inherent, predictable crash in the 
above sketched scenario, or a bug; 2) is it fixed in current -current; 
and 3) if the answer is "no" to both of the previous questions, what may 
possibly be done to fix it.

thx
mortee

PS.: Formerly I tried null-mounting / on /var/tmp/chroot also, using a 
modified /sbin/mount_null with the check for distinct directories 
disabled. It resulted in the same locking panic; but I accounted that 
crash to the assumption that mount_null had a valid reason to not allow 
mounting non-distinct directories over each other by default. Now this 
also became an open question whether null-mounting /a/b over /a/b/c/d is 
expected to cause a locikng error and kernel panic.