Copyright 2000, International Business Machines Corporation and others. All Rights Reserved. This software has been released under the terms of the IBM Public License. For details, see the LICENSE file in the top-level source directory or online at http://www.openafs.org/dl/license10.html Locking order (in order of locking) -- 1. PVN lock in cache entry. Locks out pvn operations on vnode from our own layer. 2. VCache entries. Multiple ones can be locked, in which case they're locked in order of vnode within the same volume. afs_AccessOK is called before locking other entries. 3. afs_xvcache locked before afs_xdcache in afs_remove, afs_symlink, etc in the file afs_vnodeops.c 4. afs_xvcache. Must be able to load new cache entries while holding locks on others. Note this means you can't lock a cache entry while holding either of this lock, unless, as in afs_create, the cache entry is actually created while the afs_xvcache is held. 5. afs_xvcb. Volume callback lock. Locked before afs_xserver in afs_RemoveVCB. 6. afs_xvolume -- allows low-level server etc stuff to happen while creating a volume? 7. afs_xuser -- afs_xuser locked before afs_xserver and afs_xconn in PUnlog. 8. afs_xcell -- locked before server in afs_GetCell. 9. afs_xserver -- afs_xserver locked before afs_xconn in afs_ResetUserConns. 10. afs_xsrvAddr -- afs_xserver locked before afs_xsrvAddr in afs_CheckServers. 11. afs_xconn -- see above 12. Individual volume locks. Must be after afs_xvolume so we can iterate over all volumes without others being inserted/deleted. Same hack doesn't work for cache entry locks since we need to be able to lock multiple cache entries (but not multiple volumes) simultaneously. 13. afs_xdnlc -- locked after afs_xvcache in afs_osidnlc.c. Shouldn't interact with any of the other locks. 14. afs_xcbhash -- No code which holds xcbhash (all of it is in afs_cbqueue.c) attempts to get any other locks, so it should always be obtained last. It is locked in afs_DequeueCallbacks which is called from afs_FlushVCache with afs_xvcache write-locked. ***** RX_ENABLE_LOCKS Many fine grained locks are used by Rx on the AIX4.1 platform. These need to be explained. It is likely they could be used preference to the afs_rxglobal_lock on AFS_GLOBAL_SUNLOCK platforms. ***** GLOBAL LOCKS 98. afs_global_lock -- This lock provides a non-preemptive environment for the bulk of the AFS kernel code on platforms that require it. Presently this includes SunOS5 and SGI53 systems. This lock is dropped and reaquired frequently, especially around calls back to the OS that may reenter AFS such as vn_rele. Generally, this lock should not be used to explicitly avoid locking data structures that need synchronization. However, much existing code is deficient in this regard (e.g. afs_getevent). 99. afs_rxglobal_lock -- This lock is obtained after the afs_global_lock at process level but is obtained independently during packet arrival "interrupts" and during fasttimo processing. ***** OS LOCKS 100. The vnode lock on SunOS and SGI53 protects the its reference count. 101. NETPRI/USERPRI -- These are not really locks but provide mutual exclusion against packet and timer interrupts.