Author: mjg
Date: Thu Oct  1 08:46:21 2020
New Revision: 366310
URL: https://svnweb.freebsd.org/changeset/base/366310

Log:
  cache: properly report ENOTDIR on foo/bar lookups where foo is a file
  
  Reported by:  fernape

Modified:
  head/sys/kern/vfs_cache.c

Modified: head/sys/kern/vfs_cache.c
==============================================================================
--- head/sys/kern/vfs_cache.c   Thu Oct  1 04:46:23 2020        (r366309)
+++ head/sys/kern/vfs_cache.c   Thu Oct  1 08:46:21 2020        (r366310)
@@ -4045,6 +4045,15 @@ static int __noinline
 cache_fplookup_failed_vexec(struct cache_fpl *fpl, int error)
 {
 
+       /*
+        * Hack: they may be looking up foo/bar, where foo is a
+        * regular file. In such a case we need to turn ENOTDIR,
+        * but we may happen to get here with a different error.
+        */
+       if (fpl->dvp->v_type != VDIR) {
+               error = ENOTDIR;
+       }
+
        switch (error) {
        case EAGAIN:
                /*
_______________________________________________
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to