* Do not allow a destroyed namecache entry to be re-resolved, as it
might resolve as a completely different file, or even resolve as
a file when it was originally a directory and so forth.
* Fixes inconsistencies in the current-dir fields in proc->p_fd.
* Note that most VFS's can't re-resolve a disconnected directory
anyway but HAMMER1 actually can, so this was causing a problem
in tests with HAMMER1 (the same tests that originally crashed
tmpfs were also crashing HAMMER1, but for a different reason).
}
/*
+ * If the ncp was destroyed it will never resolve again. This
+ * can basically only happen when someone is chdir'd into an
+ * empty directory which is then rmdir'd. We want to catch this
+ * here and not dive the VFS because the VFS might actually
+ * have a way to re-resolve the disconnected ncp, which will
+ * result in inconsistencies in the cdir/nch for proc->p_fd.
+ */
+ if (ncp->nc_flag & NCF_DESTROYED) {
+ kprintf("Warning: cache_resolve: ncp '%s' was unlinked\n",
+ ncp->nc_name);
+ return(EINVAL);
+ }
+
+ /*
* Mount points need special handling because the parent does not
* belong to the same filesystem as the ncp.
*/