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

Liu Bo bo.liu at linux.alibaba.com
Fri Aug 2 23:06:58 UTC 2019


On Fri, Aug 02, 2019 at 07:12:23PM +0800, Peng Tao wrote:
> Right now we always enable it regardless of given commandlines.
> Fix it by setting the flag relying on the lo->flock bit.
>

Good catch.

Reviewed-by: Liu Bo <bo.liu at linux.alibaba.com>

thanks,
-liubo
> 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