fuse: don't advise readdirplus for negative lookup
authorMiklos Szeredi <mszeredi@redhat.com>
Mon, 21 Oct 2019 13:57:07 +0000 (15:57 +0200)
committerMiklos Szeredi <mszeredi@redhat.com>
Mon, 21 Oct 2019 13:57:07 +0000 (15:57 +0200)
If the FUSE_READDIRPLUS_AUTO feature is enabled, then lookups on a
directory before/during readdir are used as an indication that READDIRPLUS
should be used instead of READDIR.  However if the lookup turns out to be
negative, then selecting READDIRPLUS makes no sense.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
fs/fuse/dir.c

index d572c900bb0f208c6a49a43b97ece1cb882687f7..b77954a275384ddc99b6268a35a0a067cbdf44a6 100644 (file)
@@ -405,7 +405,8 @@ static struct dentry *fuse_lookup(struct inode *dir, struct dentry *entry,
        else
                fuse_invalidate_entry_cache(entry);
 
-       fuse_advise_use_readdirplus(dir);
+       if (inode)
+               fuse_advise_use_readdirplus(dir);
        return newent;
 
  out_iput: