[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

translators holding a ref to underlying node

From: Roland McGrath
Subject: translators holding a ref to underlying node
Date: Sat, 5 May 2001 21:41:17 -0400 (EDT)

> If we want to do as you suggest and only destroy a node when the there is
> no active translator, we must add a user reference when an active
> translator is started and drop one when the control port dies.  This
> implies asking for dead name notification on active translator control
> ports and changing the interfaces to fshelp_fetch_root to permit it to
> add a user reference when it starts a translator or allow it to indicate
> that it started the active translator.

I think this is the right thing to do.  It should probably be a weak
reference, so when there are no more hard refs and st_nlink==0, we
deallocate the translator port.  (Because in that case, the active
translator is no longer reachable in any way from the parent filesystem.)

Hopefully most of the work can be done in fshelp with some simple hooks.

When you think about implementing all this, it certainly seems simpler to
just declare it a protocol requirement that active translators hold a ref
to their underlying node just for the purpose of keeping the active
translator connection alive.  But that really is not the proper separation
of responsibilities.  To illustrate why it matters, I think of the
following scenario.  If done what I think is the right way, you could start
a filesystem as an active translator attached to /foo/bar, giving it some
option to short-circuit its /.. -> /; then use the /foo/bar entry to put
things on the filesystem, chdir and chroot processes into it, and so forth;
finally, if all processes have been redirected or enough old ones killed so
that noone has any ports to the original /foo (or even /) filesystems,
there will be no reason for them to stay up and they can die happy; then
you can physically remove the disks or whatever else you can do.  Obviously
such a scenario is a bit far-fetched and there are many many things that
must come together very cleanly for this to actually work smoothly as
described.  But if all those things did come together, then keeping an
unused reference to the underlying node would be the thing preventing me
from ejecting my hot-swap drive.

> Take a look at both ext2fs and ufs.  Neither deallocates its reference to
> the underlying node.

Contrary to the propaganda of the time, Bushnells do write bugs.
Copying them doesn't make them less wrong.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]