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 @@ -636,11 +636,15 @@ case CACHE_FPL_STATUS_HANDLED: if (error == 0) NDVALIDATE(ndp); - else if (__predict_false(pwd->pwd_adir != pwd->pwd_rdir && - (cnp->cn_flags & ISRESTARTED) == 0)) { - namei_cleanup_cnp(cnp); - NDRESTART(ndp); - goto restart; + else if (__predict_false(pwd->pwd_adir != pwd->pwd_rdir)) { + if (error == EEXIST) + return error; + + if((cnp->cn_flags & ISRESTARTED) == 0) { + namei_cleanup_cnp(cnp); + NDRESTART(ndp); + goto restart; + } } return (error); case CACHE_FPL_STATUS_PARTIAL: