Fix a "v_seqc_users == 0 not met" panic when VFS_STATFS() fails during mount.

r363210 introduced v_seqc_users to the vnodes.  This change requires
a vn_seqc_write_end() to match the vn_seqc_write_begin() in
vfs_cache_root_clear().
mjg@ provided this patch which seems to fix the panic.

Tested for an NFS mount where the VFS_STATFS() call will fail.

Submitted by:	mjg
Reviewed by:	mjg
Differential Revision:	https://reviews.freebsd.org/D26160
This commit is contained in:
Rick Macklem 2020-08-26 21:49:43 +00:00
parent 113bcc82a2
commit df665abd34
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=364844

View File

@ -969,11 +969,14 @@ vfs_domount_first(
if ((error = VFS_MOUNT(mp)) != 0 ||
(error1 = VFS_STATFS(mp, &mp->mnt_stat)) != 0 ||
(error1 = VFS_ROOT(mp, LK_EXCLUSIVE, &newdp)) != 0) {
rootvp = NULL;
if (error1 != 0) {
error = error1;
rootvp = vfs_cache_root_clear(mp);
if (rootvp != NULL)
if (rootvp != NULL) {
vhold(rootvp);
vrele(rootvp);
}
if ((error1 = VFS_UNMOUNT(mp, 0)) != 0)
printf("VFS_UNMOUNT returned %d\n", error1);
}
@ -983,6 +986,10 @@ vfs_domount_first(
VI_LOCK(vp);
vp->v_iflag &= ~VI_MOUNT;
VI_UNLOCK(vp);
if (rootvp != NULL) {
vn_seqc_write_end(rootvp);
vdrop(rootvp);
}
vn_seqc_write_end(vp);
vrele(vp);
return (error);