From c31e93450fa449515d8c27dead51bb101cf057a5 Mon Sep 17 00:00:00 2001 From: Jeff Roberson Date: Sat, 4 Oct 2003 14:32:55 +0000 Subject: [PATCH] - Document more of the vnode locking strategy. --- sys/sys/vnode.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index a222469c98cf..c922d7bd6b9a 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -95,8 +95,17 @@ struct vpollinfo { * u - Only a reference to the vnode is needed to read. * v - vnode lock * + * Vnodes may be found on many lists. The general way to deal with operating + * on a vnode that is on a list is: + * 1) Lock the list and find the vnode. + * 2) Lock interlock so that the vnode does not go away. + * 3) Unlock the list to avoid lock order reversals. + * 4) vget with LK_INTERLOCK and check for ENOENT, or + * 5) Check for XLOCK if the vnode lock is not required. + * 6) Perform your operation, then vput(). + * * XXX Not all fields are locked yet and some fields that are marked are not - * locked consistently. This is a work in progress. + * locked consistently. This is a work in progress. Requires Giant! */ struct vnode {