diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index ae9ef7fa1a7..14c29232f8a 100644 --- a/sys/kern/vfs_subr.c +++ b/sys/kern/vfs_subr.c @@ -2397,6 +2397,17 @@ loop: VI_LOCK(vp); mtx_unlock(&mntvnode_mtx); vn_lock(vp, LK_INTERLOCK | LK_EXCLUSIVE | LK_RETRY, td); + /* + * This vnode could have been reclaimed while we were + * waiting for the lock since we are not holding a + * reference. + * Start over if the vnode was reclaimed. + */ + if (vp->v_mount != mp) { + VOP_UNLOCK(vp, 0, td); + mtx_lock(&mntvnode_mtx); + goto loop; + } /* * Skip over a vnodes marked VV_SYSTEM. */