Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 May 2026 07:57:37 +0000
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ea10118fe373 - stable/15 - vfs_domount(): handle the case when vn_lock_pair() only locked once
Message-ID:  <6a17f571.20698.d0d0db4@gitrepo.freebsd.org>

index | next in thread | raw e-mail

The branch stable/15 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=ea10118fe3736cd079b335e0f471b9fa853460e4

commit ea10118fe3736cd079b335e0f471b9fa853460e4
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2026-05-17 21:27:52 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2026-05-28 07:57:14 +0000

    vfs_domount(): handle the case when vn_lock_pair() only locked once
    
    (cherry picked from commit f5433e784078ee139a37eb43ffa1d9e0e1f4f217)
---
 sys/kern/vfs_mount.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c
index 383ccf98c10e..9cea2d8acc64 100644
--- a/sys/kern/vfs_mount.c
+++ b/sys/kern/vfs_mount.c
@@ -1281,7 +1281,8 @@ vfs_domount_first(
 	 * Use vn_lock_pair to avoid establishing an ordering between vnodes
 	 * from different filesystems.
 	 */
-	vn_lock_pair(vp, false, LK_EXCLUSIVE, newdp, false, LK_EXCLUSIVE);
+	error1 = vn_lock_pair(vp, false, LK_EXCLUSIVE, newdp, false,
+	    LK_EXCLUSIVE);
 
 	VI_LOCK(vp);
 	vp->v_iflag &= ~VI_MOUNT;
@@ -1291,7 +1292,10 @@ vfs_domount_first(
 	TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list);
 	mtx_unlock(&mountlist_mtx);
 	vfs_event_signal(NULL, VQ_MOUNT, 0);
-	VOP_UNLOCK(vp);
+	if (error1 == 0)
+		VOP_UNLOCK(vp);
+	else
+		MPASS(error1 == EDEADLK);
 	EVENTHANDLER_DIRECT_INVOKE(vfs_mounted, mp, newdp, td);
 	VOP_UNLOCK(newdp);
 	mount_devctl_event("MOUNT", mp, false);


home | help

Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a17f571.20698.d0d0db4>