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
This commit is contained in:
rmacklem 2020-03-22 18:18:30 +00:00
parent 4f762619a5
commit 9482ee93e3

View File

@ -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);
}