Lock the vnode in the most exclusive lock mode requested, once. All callers already ensure that vp1 != vp2 or are careful enough to only unlock once otherwise.
Details
Details
- Reviewers
jah markj - Commits
- rG22bac49b09a9: vn_lock_pair(): reasonably handle vp1 == vp2 case
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Skipped - Unit
Tests Skipped
Event Timeline
sys/kern/vfs_vnops.c | ||
---|---|---|
4079 | This is micro-optimization, not strictly needed for correctness. Added. |
sys/kern/vfs_vnops.c | ||
---|---|---|
4079 | LK_NOSHARE seems to mean, "silently upgrade share lock requests to exclusive lock requests." I don't see how that's just an optimization. In particular, if the caller requests LK_SHARE, we should honour LK_NOSHARE and change the request to LK_EXCLUSIVE. |
sys/kern/vfs_vnops.c | ||
---|---|---|
4079 | The change happens inside lockmgr. If passed vnode is lk_noshare and locked, it is locked exlusive. Optimization then consists in avoiding unlock. |