diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -717,6 +717,11 @@ cnp->cn_nameptr = cnp->cn_pnbuf; if (*(cnp->cn_nameptr) == '/') { vrele(dp); + /* Reset the lookup to start from the real root. */ + if (__predict_false(ndp->ni_rootdir != pwd->pwd_rdir)) { + cnp->cn_flags |= ISRESTARTED; + ndp->ni_rootdir = pwd->pwd_rdir; + } error = namei_handle_root(ndp, &dp); if (error != 0) goto out;