Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F162715851
D57035.id177947.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57035.id177947.diff
View Options
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -4354,7 +4354,10 @@
* Only one of LK_SHARED and LK_EXCLUSIVE must be specified.
* LK_NODDLKTREAT can be optionally passed.
*
- * If vp1 == vp2, only one, most exclusive, lock is obtained on it.
+ * If vp1->v_vnlock == vp2->v_vnlock, only one, most exclusive, lock
+ * is obtained on the vnode(s). The function accounts for the
+ * possibility of vp1 or vp2' v_vnlock changing while the
+ * corresponding vnode is unlocked.
*/
void
vn_lock_pair(struct vnode *vp1, bool vp1_locked, int lkflags1,
@@ -4372,7 +4375,8 @@
if (vp1 == NULL && vp2 == NULL)
return;
- if (vp1 == vp2) {
+recheck_same:
+ if (vp1->v_vnlock == vp2->v_vnlock) {
MPASS(vp1_locked == vp2_locked);
/* Select the most exclusive mode for lock. */
@@ -4398,7 +4402,13 @@
ASSERT_VOP_UNLOCKED(vp1, "vp1");
vn_lock(vp1, lkflags1 | LK_RETRY);
- return;
+ if (vp1->v_vnlock == vp2->v_vnlock)
+ return;
+ VOP_UNLOCK(vp1);
+ if (vp2_locked) {
+ VOP_UNLOCK(vp2);
+ vp2_locked = false;
+ }
}
if (vp1 != NULL) {
@@ -4469,6 +4479,8 @@
vn_lock(vp1, lkflags1 | LK_RETRY);
vp1_locked = true;
}
+ if (vp1->v_vnlock == vp2->v_vnlock)
+ goto recheck_same;
}
if (vp1 != NULL) {
if (lkflags1 == LK_EXCLUSIVE)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jul 17, 2:32 AM (16 h, 51 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
33218476
Default Alt Text
D57035.id177947.diff (1 KB)
Attached To
Mode
D57035: vn_lock_pair(): handle the case of vp1->v_vnlock == vp2->v_vnlock
Attached
Detach File
Event Timeline
Log In to Comment