[Virtio-fs] [PATCH] virtiofsd: do not always set FUSE_FLOCK_LOCKS

Peng Tao tao.peng at linux.alibaba.com
Fri Aug 2 11:12:23 UTC 2019


Right now we always enable it regardless of given commandlines.
Fix it by setting the flag relying on the lo->flock bit.

Signed-off-by: Peng Tao <tao.peng at linux.alibaba.com>
---
 contrib/virtiofsd/passthrough_ll.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/contrib/virtiofsd/passthrough_ll.c b/contrib/virtiofsd/passthrough_ll.c
index a81c01d..be75cb8 100644
--- a/contrib/virtiofsd/passthrough_ll.c
+++ b/contrib/virtiofsd/passthrough_ll.c
@@ -440,10 +440,16 @@ static void lo_init(void *userdata,
 			fuse_debug("lo_init: activating writeback\n");
 		conn->want |= FUSE_CAP_WRITEBACK_CACHE;
 	}
-	if (lo->flock && conn->capable & FUSE_CAP_FLOCK_LOCKS) {
-		if (lo->debug)
-			fuse_debug("lo_init: activating flock locks\n");
-		conn->want |= FUSE_CAP_FLOCK_LOCKS;
+	if (conn->capable & FUSE_CAP_FLOCK_LOCKS) {
+		if (lo->flock) {
+			if (lo->debug)
+				fuse_debug("lo_init: activating flock locks\n");
+			conn->want |= FUSE_CAP_FLOCK_LOCKS;
+		} else {
+			if (lo->debug)
+				fuse_debug("lo_init: disabling flock locks\n");
+			conn->want &= ~FUSE_CAP_FLOCK_LOCKS;
+		}
 	}
 	/* TODO: shared version support for readdirplus */
 
-- 
1.8.3.1




More information about the Virtio-fs mailing list