yeahuh / rpms / qemu-kvm

Forked from rpms/qemu-kvm 2 years ago
Clone

Blame SOURCES/kvm-virtiofsd-passthrough_ll-control-readdirplus.patch

22c213
From 0f1d456fad4ba6a696eff8976b9fe8a0f251e1b5 Mon Sep 17 00:00:00 2001
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
Date: Mon, 27 Jan 2020 19:01:47 +0100
22c213
Subject: [PATCH 076/116] virtiofsd: passthrough_ll: control readdirplus
22c213
MIME-Version: 1.0
22c213
Content-Type: text/plain; charset=UTF-8
22c213
Content-Transfer-Encoding: 8bit
22c213
22c213
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
Message-id: <20200127190227.40942-73-dgilbert@redhat.com>
22c213
Patchwork-id: 93524
22c213
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 072/112] virtiofsd: passthrough_ll: control readdirplus
22c213
Bugzilla: 1694164
22c213
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22c213
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
22c213
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
22c213
22c213
From: Miklos Szeredi <mszeredi@redhat.com>
22c213
22c213
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
22c213
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
(cherry picked from commit 59aef494be2d8d91055ff3f3a8eb13d9f32873d8)
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
---
22c213
 tools/virtiofsd/helper.c         | 4 ++++
22c213
 tools/virtiofsd/passthrough_ll.c | 7 ++++++-
22c213
 2 files changed, 10 insertions(+), 1 deletion(-)
22c213
22c213
diff --git a/tools/virtiofsd/helper.c b/tools/virtiofsd/helper.c
22c213
index 6d50a46..14f5d70 100644
22c213
--- a/tools/virtiofsd/helper.c
22c213
+++ b/tools/virtiofsd/helper.c
22c213
@@ -153,6 +153,10 @@ void fuse_cmdline_help(void)
22c213
            "                               allowed (default: 10)\n"
22c213
            "    -o norace                  disable racy fallback\n"
22c213
            "                               default: false\n"
22c213
+           "    -o readdirplus|no_readdirplus\n"
22c213
+           "                               enable/disable readirplus\n"
22c213
+           "                               default: readdirplus except with "
22c213
+           "cache=never\n"
22c213
           );
22c213
 }
22c213
 
22c213
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
22c213
index 6480c51..8b1784f 100644
22c213
--- a/tools/virtiofsd/passthrough_ll.c
22c213
+++ b/tools/virtiofsd/passthrough_ll.c
22c213
@@ -117,6 +117,8 @@ struct lo_data {
22c213
     double timeout;
22c213
     int cache;
22c213
     int timeout_set;
22c213
+    int readdirplus_set;
22c213
+    int readdirplus_clear;
22c213
     struct lo_inode root; /* protected by lo->mutex */
22c213
     struct lo_map ino_map; /* protected by lo->mutex */
22c213
     struct lo_map dirp_map; /* protected by lo->mutex */
22c213
@@ -140,6 +142,8 @@ static const struct fuse_opt lo_opts[] = {
22c213
     { "cache=auto", offsetof(struct lo_data, cache), CACHE_NORMAL },
22c213
     { "cache=always", offsetof(struct lo_data, cache), CACHE_ALWAYS },
22c213
     { "norace", offsetof(struct lo_data, norace), 1 },
22c213
+    { "readdirplus", offsetof(struct lo_data, readdirplus_set), 1 },
22c213
+    { "no_readdirplus", offsetof(struct lo_data, readdirplus_clear), 1 },
22c213
     FUSE_OPT_END
22c213
 };
22c213
 static bool use_syslog = false;
22c213
@@ -478,7 +482,8 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
22c213
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
22c213
         conn->want |= FUSE_CAP_FLOCK_LOCKS;
22c213
     }
22c213
-    if (lo->cache == CACHE_NEVER) {
22c213
+    if ((lo->cache == CACHE_NEVER && !lo->readdirplus_set) ||
22c213
+        lo->readdirplus_clear) {
22c213
         fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling readdirplus\n");
22c213
         conn->want &= ~FUSE_CAP_READDIRPLUS;
22c213
     }
22c213
-- 
22c213
1.8.3.1
22c213