Permalink
Browse files

Don't enable adaptive readdirplus unless fs has readdir() handler.

  • Loading branch information...
Nikratio committed Sep 17, 2018
1 parent 161983e commit 7b0075c06f171cdac7a3d565463c0e5938dff04d
Showing with 27 additions and 5 deletions.
  1. +10 −0 ChangeLog.rst
  2. +15 −4 include/fuse_common.h
  3. +2 −1 lib/fuse_lowlevel.c
@@ -1,3 +1,13 @@
Unreleased Changes
=================

* The FUSE_CAP_READDIRPLUS_AUTO capability is no longer enabled by
default unless the file system defines both a readdir() and a
readdirplus() handler.

* The description of the FUSE_CAP_READDIRPLUS_AUTO flag has been
improved.

libfuse 3.2.6 (2018-08-31)
==========================

@@ -219,18 +219,29 @@ struct fuse_loop_config {
#define FUSE_CAP_AUTO_INVAL_DATA (1 << 12)

/**
* Indicates that the filesystem supports readdirplus
* Indicates that the filesystem supports readdirplus.
*
* This feature is enabled by default when supported by the kernel and if the
* filesystem implements a readdirplus() handler.
*/
#define FUSE_CAP_READDIRPLUS (1 << 13)

/**
* Indicates that the filesystem supports adaptive readdirplus
* Indicates that the filesystem supports adaptive readdirplus.
*
* This feature is enabled by default when supported by the kernel and if the
* filesystem implements a readdirplus() handler.
* If FUSE_CAP_READDIRPLUS is not set, this flag has no effect.
*
* If FUSE_CAP_READDIRPLUS is set and this flag is not set, the kernel
* will always issue readdirplus() requests to retrieve directory
* contents.
*
* If FUSE_CAP_READDIRPLUS is set and this flag is set, the kernel
* will issue both readdir() and readdirplus() requests, depending on
* how much information is expected to be required.
*
* This feature is enabled by default when supported by the kernel and
* if the filesystem implements both a readdirplus() and a readdir()
* handler.
*/
#define FUSE_CAP_READDIRPLUS_AUTO (1 << 14)

@@ -1918,7 +1918,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
FUSE_CAP_POSIX_LOCKS);
LL_SET_DEFAULT(se->op.flock, FUSE_CAP_FLOCK_LOCKS);
LL_SET_DEFAULT(se->op.readdirplus, FUSE_CAP_READDIRPLUS);
LL_SET_DEFAULT(se->op.readdirplus, FUSE_CAP_READDIRPLUS_AUTO);
LL_SET_DEFAULT(se->op.readdirplus && se->op.readdir,
FUSE_CAP_READDIRPLUS_AUTO);
se->conn.time_gran = 1;

if (bufsize < FUSE_MIN_READ_BUFFER) {

0 comments on commit 7b0075c

Please sign in to comment.