svn commit: r359219 - head/sys/kern

Rick Macklem rmacklem at FreeBSD.org
Sun Mar 22 18:18:30 UTC 2020


Author: rmacklem
Date: Sun Mar 22 18:18:30 2020
New Revision: 359219
URL: https://svnweb.freebsd.org/changeset/base/359219

Log:
  Fix an NFS mount attempt where VFS_STATFS() fails.
  
  r353150 added mnt_rootvnode and this seems to have broken NFS mounts when the
  VFS_STATFS() called just after VFS_MOUNT() returns an error.
  Then the code calls VFS_UNMOUNT(), which calls vflush(), which returns EBUSY.
  Then the thread get stuck sleeping on "mntref" in vfs_mount_destroy().
  This patch fixes this problem.
  
  Reviewed by:	kib, mjg
  Differential Revision:	https://reviews.freebsd.org/D24022

Modified:
  head/sys/kern/vfs_mount.c

Modified: head/sys/kern/vfs_mount.c
==============================================================================
--- head/sys/kern/vfs_mount.c	Sun Mar 22 17:59:36 2020	(r359218)
+++ head/sys/kern/vfs_mount.c	Sun Mar 22 18:18:30 2020	(r359219)
@@ -900,7 +900,7 @@ vfs_domount_first(
 {
 	struct vattr va;
 	struct mount *mp;
-	struct vnode *newdp;
+	struct vnode *newdp, *rootvp;
 	int error, error1;
 
 	ASSERT_VOP_ELOCKED(vp, __func__);
@@ -967,6 +967,9 @@ vfs_domount_first(
 	    (error1 = VFS_ROOT(mp, LK_EXCLUSIVE, &newdp)) != 0) {
 		if (error1 != 0) {
 			error = error1;
+			rootvp = vfs_cache_root_clear(mp);
+			if (rootvp != NULL)
+				vrele(rootvp);
 			if ((error1 = VFS_UNMOUNT(mp, 0)) != 0)
 				printf("VFS_UNMOUNT returned %d\n", error1);
 		}


More information about the svn-src-head mailing list