Blame 0103-virtiofsd-do-not-always-set-FUSE_FLOCK_LOCKS.patch

1d442b
From: Peng Tao <tao.peng@linux.alibaba.com>
1d442b
Date: Mon, 27 Jan 2020 19:02:12 +0000
1d442b
Subject: [PATCH] virtiofsd: do not always set FUSE_FLOCK_LOCKS
1d442b
1d442b
Right now we always enable it regardless of given commandlines.
1d442b
Fix it by setting the flag relying on the lo->flock bit.
1d442b
1d442b
Signed-off-by: Peng Tao <tao.peng@linux.alibaba.com>
1d442b
Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>
1d442b
Reviewed-by: Sergio Lopez <slp@redhat.com>
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
(cherry picked from commit e468d4af5f5192ab33283464a9f6933044ce47f7)
1d442b
---
1d442b
 tools/virtiofsd/passthrough_ll.c | 11 ++++++++---
1d442b
 1 file changed, 8 insertions(+), 3 deletions(-)
1d442b
1d442b
diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
1d442b
index ab1613586e..ccbbec18b0 100644
1d442b
--- a/tools/virtiofsd/passthrough_ll.c
1d442b
+++ b/tools/virtiofsd/passthrough_ll.c
1d442b
@@ -546,9 +546,14 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
1d442b
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating writeback\n");
1d442b
         conn->want |= FUSE_CAP_WRITEBACK_CACHE;
1d442b
     }
1d442b
-    if (lo->flock && conn->capable & FUSE_CAP_FLOCK_LOCKS) {
1d442b
-        fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
1d442b
-        conn->want |= FUSE_CAP_FLOCK_LOCKS;
1d442b
+    if (conn->capable & FUSE_CAP_FLOCK_LOCKS) {
1d442b
+        if (lo->flock) {
1d442b
+            fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
1d442b
+            conn->want |= FUSE_CAP_FLOCK_LOCKS;
1d442b
+        } else {
1d442b
+            fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling flock locks\n");
1d442b
+            conn->want &= ~FUSE_CAP_FLOCK_LOCKS;
1d442b
+        }
1d442b
     }
1d442b
 
1d442b
     if (conn->capable & FUSE_CAP_POSIX_LOCKS) {