mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 13:38:01 +00:00
Andrew Deason
fad319fea2
FBSD: Check VOP_ISLOCKED for LK_EXCLUSIVE
A couple of places in the code check if a vnode is locked by the current thread by simply checking 'if (VOP_ISLOCKED(vp))'. But VOP_ISLOCKED() doesn't just return a simple 1 or 0, it returns LK_* constants (or 0). LK_EXCLUSIVE indicates that the calling thread holds an exclusive lock on the vnode, but LK_SHARED means someone holds a shared lock (possibly not the current thread), and LK_EXCLOTHER indicates that a different thread holds an exclusive lock. Because of this, it's possible for us to skip grabbing the vnode lock for certain operations, if someone else holds the lock at the same time. For example, this can happen when we call vinvalbuf() inside afs_GetVCache(), and FreeBSD will warn us that we didn't lock the vnode: #0 0xffffffff80bf6557 at kdb_backtrace+0x67 #1 0xffffffff80c7a337 at assert_vop_locked+0x77 #2 0xffffffff80c7a273 at vinvalbuf+0x23 #3 0xffffffff8285aa2d at afs_GetVCache+0x25d #4 0xffffffff828d3325 at afs_root+0x145 #5 0xffffffff80c70296 at lookup+0x8c6 #6 0xffffffff80c6f599 at namei+0x4a9 #7 0xffffffff80c872e4 at sys_lpathconf+0x54 #8 0xffffffff81074581 at amd64_syscall+0x291 #9 0xffffffff8104cde0 at fast_syscall_common+0x101 vnode 0xfffff8012a62bc58: tag afs, type VDIR usecount 2, writecount 0, refcount 2 mountedhere 0 flags (VV_ROOT|VI_ACTIVE) lock type afs: UNLOCKED #0 0xffffffff80b81fc2 at lockmgr_lock_fast_path+0x1e2 #1 0xffffffff811fa9f6 at VOP_LOCK1_APV+0x96 #2 0xffffffff80c8c705 at _vn_lock+0x65 #3 0xffffffff80c7c066 at vget+0xa6 #4 0xffffffff828d3437 at afs_root+0x257 #5 0xffffffff80c70296 at lookup+0x8c6 #6 0xffffffff80c6f599 at namei+0x4a9 #7 0xffffffff80c872e4 at sys_lpathconf+0x54 #8 0xffffffff81074581 at amd64_syscall+0x291 #9 0xffffffff8104cde0 at fast_syscall_common+0x101 vc 0xfffffe002be00000 vp 0xfffff8012a62bc58 tag afs, fid: 1.536870924.1.1, opens 0, writers 0 To fix this, change our "islocked"-style checks to check if VOP_ISLOCKED() returns LK_EXCLUSIVE specifically. Change-Id: If322f62dc443ee9acc2349a23c6c618afd3e29d4 Reviewed-on: https://gerrit.openafs.org/14204 Reviewed-by: Benjamin Kaduk <kaduk@mit.edu> Tested-by: BuildBot <buildbot@rampaginggeek.com>
AFS is a distributed file system that enables users to share and access all of the files stored in a network of computers as easily as they access the files stored on their local machines. The file system is called distributed for this exact reason: files can reside on many different machines, but are available to users on every machine. OpenAFS 1.0 was originally released by IBM under the terms of the IBM Public License 1.0 (IPL10). For details on IPL10 see the LICENSE file in this directory. The current OpenAFS distribution is licensed under a combination of the IPL10 and many other licenses as granted by the relevant copyright holders. The LICENSE file in this directory contains more details, thought it is not a comprehensive statement. See INSTALL for information about building and installing OpenAFS on various platforms. See CODING for developer information and guidelines. See NEWS for recent changes to OpenAFS.
Description
Languages
C
72.2%
C++
20.1%
Makefile
1.4%
Perl
1.2%
Rich Text Format
1%
Other
3.7%