Subject: vnode uniqueness question
To: None <tech-kern@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-kern
Date: 08/09/2002 10:34:30
I have a question about vnodes and uniqueness: is it an error to have
two distinct vnodes that refer to the same entity?  I've been looking
through various filesystem lookup routines and I can't see anything
that prevents it, but I can also see some interesting failure modes
looming if (for example) looking up .. twice returns different vnodes,
even if they both refer to the same filesystem entity.

For example, kernfs_lookup calls getnewvnode() for every lookup (aside
from ., and .. which it should never be asked to handle).  Is this
broken, or is it acceptable only because it can never get into
interesting situations because it (a) doesn't implement subdirectories,
(b) never blocks in any of its other VOP_* calls, and (c) counts on the
kernel being single-threaded to prevent other collisions (it uses the
genfs locking routines, which lock only the vnode)?  What about SMP?

Or am I confused and it's perfectly okay to have multiple vnodes
kicking around that refer to the same underlying entity?  I note that
procfs and ffs are careful to always return the existing vnode for any
given entity if there is one....

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B