9fans archive / 2000 / 07 / 63 /    prev next

From: presotto@pla...
Subject: re: [9fans] bind -ac B A
Date: Tue, 4 Jul 2000 09:20:02 -0400

In answer to kenji's paradox...

Perhaps this will help explain:

% mkdir A
% mkdir B
% bind -a B A
% touch A/x
touch: A/x: cannot create: mounted directory forbids creation
% unmount A
% bind -c A A
% bind -ac B A
% touch A/x
% unmount A
% ls -l A B
--rw-rw-r-- M 6 presotto presotto 0 Jul  4 08:52 A/x
%

A mount point is an ordered list of binds and mounts.  If
you do

% bind -a B A

onto an A that isn't already a mount point, then there's
no list of mount/bind's to chain this one after.  Therfore,
the kernel does an implicit bind of A onto A to be the first mount
point in the list.  It then appends the bind of B onto A to the
list.  That first inplicit bind doesn't have the create bit set
so B is the first thing in the list with create priviledge.

The original version of plan 9 actually required you to
explicitly bind A onto itself before letting you bind
B onto A.  That was a bit awkward so we made it automatic.
Unfortunately, we may also make it counterintuitive but
I like not typing all those gratuitous extra binds.