render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame 0078-virtiofsd-passthrough_ll-control-readdirplus.patch

1d442b
From: Miklos Szeredi <mszeredi@redhat.com>
1d442b
Date: Mon, 27 Jan 2020 19:01:47 +0000
1d442b
Subject: [PATCH] virtiofsd: passthrough_ll: control readdirplus
1d442b
1d442b
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1d442b
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
(cherry picked from commit 59aef494be2d8d91055ff3f3a8eb13d9f32873d8)
1d442b
---
1d442b
 tools/virtiofsd/helper.c         | 4 ++++
1d442b
 tools/virtiofsd/passthrough_ll.c | 7 ++++++-
1d442b
 2 files changed, 10 insertions(+), 1 deletion(-)
1d442b
1d442b
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
1d442b
index 6d50a46a7e..14f5d70c10 100644
1d442b
--- a/tools/virtiofsd/helper.c
1d442b
+++ b/tools/virtiofsd/helper.c
1d442b
@@ -153,6 +153,10 @@ void fuse_cmdline_help(void)
1d442b
            "                               allowed (default: 10)\n"
1d442b
            "    -o norace                  disable racy fallback\n"
1d442b
            "                               default: false\n"
1d442b
+           "    -o readdirplus|no_readdirplus\n"
1d442b
+           "                               enable/disable readirplus\n"
1d442b
+           "                               default: readdirplus except with "
1d442b
+           "cache=never\n"
1d442b
           );
1d442b
 }
1d442b
 
1d442b
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
1d442b
index 6480c517dc..8b1784ff7b 100644
1d442b
--- a/tools/virtiofsd/passthrough_ll.c
1d442b
+++ b/tools/virtiofsd/passthrough_ll.c
1d442b
@@ -117,6 +117,8 @@ struct lo_data {
1d442b
     double timeout;
1d442b
     int cache;
1d442b
     int timeout_set;
1d442b
+    int readdirplus_set;
1d442b
+    int readdirplus_clear;
1d442b
     struct lo_inode root; /* protected by lo->mutex */
1d442b
     struct lo_map ino_map; /* protected by lo->mutex */
1d442b
     struct lo_map dirp_map; /* protected by lo->mutex */
1d442b
@@ -140,6 +142,8 @@ static const struct fuse_opt lo_opts[] = {
1d442b
     { "cache=auto", offsetof(struct lo_data, cache), CACHE_NORMAL },
1d442b
     { "cache=always", offsetof(struct lo_data, cache), CACHE_ALWAYS },
1d442b
     { "norace", offsetof(struct lo_data, norace), 1 },
1d442b
+    { "readdirplus", offsetof(struct lo_data, readdirplus_set), 1 },
1d442b
+    { "no_readdirplus", offsetof(struct lo_data, readdirplus_clear), 1 },
1d442b
     FUSE_OPT_END
1d442b
 };
1d442b
 static bool use_syslog = false;
1d442b
@@ -478,7 +482,8 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
1d442b
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
1d442b
         conn->want |= FUSE_CAP_FLOCK_LOCKS;
1d442b
     }
1d442b
-    if (lo->cache == CACHE_NEVER) {
1d442b
+    if ((lo->cache == CACHE_NEVER && !lo->readdirplus_set) ||
1d442b
+        lo->readdirplus_clear) {
1d442b
         fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
1d442b
         conn->want &= ~FUSE_CAP_READDIRPLUS;
1d442b
     }