22c213
From 8e6473e906dfc7d2a62abaf1ec80ff461e4d201d Mon Sep 17 00:00:00 2001
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
Date: Mon, 27 Jan 2020 19:02:12 +0100
22c213
Subject: [PATCH 101/116] virtiofsd: do not always set FUSE_FLOCK_LOCKS
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-98-dgilbert@redhat.com>
22c213
Patchwork-id: 93551
22c213
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 097/112] virtiofsd: do not always set FUSE_FLOCK_LOCKS
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: Peng Tao <tao.peng@linux.alibaba.com>
22c213
22c213
Right now we always enable it regardless of given commandlines.
22c213
Fix it by setting the flag relying on the lo->flock bit.
22c213
22c213
Signed-off-by: Peng Tao <tao.peng@linux.alibaba.com>
22c213
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
22c213
Reviewed-by: Sergio Lopez <slp@redhat.com>
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
(cherry picked from commit e468d4af5f5192ab33283464a9f6933044ce47f7)
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
---
22c213
 tools/virtiofsd/passthrough_ll.c | 11 ++++++++---
22c213
 1 file changed, 8 insertions(+), 3 deletions(-)
22c213
22c213
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
22c213
index ab16135..ccbbec1 100644
22c213
--- a/tools/virtiofsd/passthrough_ll.c
22c213
+++ b/tools/virtiofsd/passthrough_ll.c
22c213
@@ -546,9 +546,14 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
22c213
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating writeback\n");
22c213
         conn->want |= FUSE_CAP_WRITEBACK_CACHE;
22c213
     }
22c213
-    if (lo->flock && conn->capable & FUSE_CAP_FLOCK_LOCKS) {
22c213
-        fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
22c213
-        conn->want |= FUSE_CAP_FLOCK_LOCKS;
22c213
+    if (conn->capable & FUSE_CAP_FLOCK_LOCKS) {
22c213
+        if (lo->flock) {
22c213
+            fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
22c213
+            conn->want |= FUSE_CAP_FLOCK_LOCKS;
22c213
+        } else {
22c213
+            fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling flock locks\n");
22c213
+            conn->want &= ~FUSE_CAP_FLOCK_LOCKS;
22c213
+        }
22c213
     }
22c213
 
22c213
     if (conn->capable & FUSE_CAP_POSIX_LOCKS) {
22c213
-- 
22c213
1.8.3.1
22c213