If VFS_STATFS() fails during an NFS mount, there is a panic
v_seqc_users == 0 not met
This patch fixes it.
(I seems to make sense, but I know nothing about the v_seqc_users
stuff.)
Differential D26160
fix panic when VFS_FSSTAT() fails during an NFS mount rmacklem on Aug 23 2020, 4:10 AM. Authored by Tags None Referenced Files
Subscribers
Details If VFS_STATFS() fails during an NFS mount, there is a panic v_seqc_users == 0 not met This patch fixes it. Tested by doing an NFS mount attempt where the VFS_STATFS()
Diff Detail
Event TimelineComment Actions I think this should go in as it is, but a helper for cleaning this up would be nice. I'll probably refactor this a little bit later. Comment Actions Actually better would be something in these lines: diff --git a/sys/kern/vfs_mount.c b/sys/kern/vfs_mount.c index 84d14fadae1..dbafd0d363d 100644 --- a/sys/kern/vfs_mount.c +++ b/sys/kern/vfs_mount.c @@ -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(rotvp); 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); The point is that we want to keep the thing in a "flux" state until the mount is fully decommissioned. |