Skip to contentSkip to conversation

virtiofsd: do not always set FUSE_FLOCK_LOCKS

PATCH Applied Peng Tao 3 participants 3 messages Aug 2, 2019 – Aug 5, 2019

lore
Share & tools
lore

Peng Tao

author
#0 lore raw

PATCH 1/1 virtiofsd: do not always set FUSE_FLOCK_LOCKS

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

---
 contrib/virtiofsd/passthrough_ll.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
contrib/virtiofsd/passthrough_ll.c +10 -4
index a81c01d..be75cb8 100644
@@ -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 */
 
Signature · 1 line
1.8.3.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · Peng Tao

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

Good catch.

thanks,
-liubo

Quoted 32 lines
---
 contrib/virtiofsd/passthrough_ll.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
contrib/virtiofsd/passthrough_ll.c +10 -4
index a81c01d..be75cb8 100644
@@ -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 */
 
Signature · 1 line
1.8.3.1
#2 lore raw
In reply to Peng Tao
Quoted 4 lines · * Peng Tao ([email protected]) wrote:

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

Thanks, applied.

Quoted 36 lines
---
 contrib/virtiofsd/passthrough_ll.c | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
contrib/virtiofsd/passthrough_ll.c +10 -4
index a81c01d..be75cb8 100644
@@ -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 */
 
Signature · 6 lines
1.8.3.1

_______________________________________________
Virtio-fs mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/virtio-fs

--
Dr. David Alan Gilbert / [email protected] / Manchester, UK