tech-kern archive

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

Vnode API change: VOP_LOCK



The current implementation of vn_lock() is racy.  Modification of
the vnode oprations vector for active vnodes is unsafe because it
is not known whether deadfs or the original file system will be
called.

- Pass down LK_RETRY to the lock operation (hint for deadfs only).

- Split deadfs lock operations from genfs_XXXlock and change
  deadfs lock operation to return ENOENT if LK_RETRY is unset.

- Change all other lock operations to check for dead vnode once
  the vnode is locked and unlock and return ENOENT in this case.

- Add flag LK_INTERLOCK (requiring LK_NOWAIT) to make it possible
  for vrelel() to try a lock with v_interlock held.

With these changes in place vnode lock operations will never succeed
after vclean() has marked the vnode as VI_XLOCK and before vclean()
has changed the operations vector.

Diff available at http://www.netbsd.org/~hannken/vnode-pass3-1.diff

Comments or objections anyone?

--
J. Hannken-Illjes - hannken%eis.cs.tu-bs.de@localhost - TU Braunschweig 
(Germany)



Home | Main Index | Thread Index | Old Index