diff mbox series

[094/104] virtiofsd: do not always set FUSE_FLOCK_LOCKS

Message ID 20191212163904.159893-95-dgilbert@redhat.com
State New
Headers show
Series virtiofs daemon [all] | expand

Commit Message

Dr. David Alan Gilbert Dec. 12, 2019, 4:38 p.m. UTC
From: Peng Tao <tao.peng@linux.alibaba.com>

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@linux.alibaba.com>
---
 tools/virtiofsd/passthrough_ll.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

Comments

Misono Tomohiro Jan. 17, 2020, 8:50 a.m. UTC | #1
> From: Peng Tao <tao.peng@linux.alibaba.com>
> 
> 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@linux.alibaba.com>

I think we should remove LL_SET_DEFAULT for flock/posix_lock in do_init()
but that can be done in another patch.

Reviewed-by: Misono Tomohiro <misono.tomohiro@jp.fujitsu.com>

> ---
>  tools/virtiofsd/passthrough_ll.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
> 
> diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
> index 8f4ab8351c..cf6b548eee 100644
> --- a/tools/virtiofsd/passthrough_ll.c
> +++ b/tools/virtiofsd/passthrough_ll.c
> @@ -548,9 +548,14 @@ static void lo_init(void *userdata, struct fuse_conn_info *conn)
>          fuse_log(FUSE_LOG_DEBUG, "lo_init: activating writeback\n");
>          conn->want |= FUSE_CAP_WRITEBACK_CACHE;
>      }
> -    if (lo->flock && conn->capable & FUSE_CAP_FLOCK_LOCKS) {
> -        fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
> -        conn->want |= FUSE_CAP_FLOCK_LOCKS;
> +    if (conn->capable & FUSE_CAP_FLOCK_LOCKS) {
> +        if (lo->flock) {
> +            fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
> +            conn->want |= FUSE_CAP_FLOCK_LOCKS;
> +        } else {
> +            fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling flock locks\n");
> +            conn->want &= ~FUSE_CAP_FLOCK_LOCKS;
> +        }
>      }
>  
>      if (conn->capable & FUSE_CAP_POSIX_LOCKS) {
> -- 
> 2.23.0
Sergio Lopez Jan. 20, 2020, 10:31 a.m. UTC | #2
Dr. David Alan Gilbert (git) <dgilbert@redhat.com> writes:

> From: Peng Tao <tao.peng@linux.alibaba.com>
>
> 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@linux.alibaba.com>
> ---
>  tools/virtiofsd/passthrough_ll.c | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)

Reviewed-by: Sergio Lopez <slp@redhat.com>
diff mbox series

Patch

diff --git a/tools/virtiofsd/passthrough_ll.c b/tools/virtiofsd/passthrough_ll.c
index 8f4ab8351c..cf6b548eee 100644
--- a/tools/virtiofsd/passthrough_ll.c
+++ b/tools/virtiofsd/passthrough_ll.c
@@ -548,9 +548,14 @@  static void lo_init(void *userdata, struct fuse_conn_info *conn)
         fuse_log(FUSE_LOG_DEBUG, "lo_init: activating writeback\n");
         conn->want |= FUSE_CAP_WRITEBACK_CACHE;
     }
-    if (lo->flock && conn->capable & FUSE_CAP_FLOCK_LOCKS) {
-        fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
-        conn->want |= FUSE_CAP_FLOCK_LOCKS;
+    if (conn->capable & FUSE_CAP_FLOCK_LOCKS) {
+        if (lo->flock) {
+            fuse_log(FUSE_LOG_DEBUG, "lo_init: activating flock locks\n");
+            conn->want |= FUSE_CAP_FLOCK_LOCKS;
+        } else {
+            fuse_log(FUSE_LOG_DEBUG, "lo_init: disabling flock locks\n");
+            conn->want &= ~FUSE_CAP_FLOCK_LOCKS;
+        }
     }
 
     if (conn->capable & FUSE_CAP_POSIX_LOCKS) {