From 702b2912970e7cc19416aff7d3696d15977efc2f Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 9 Nov 2012 14:43:38 +0100 Subject: fuse: handle mountflags properly The internal mount API had no access to the generic mountflags used by mount(2). Thus the "ro" mount option that needs to be passed down to mount(2) as as a mountflag was incorrectly mangled into the fuse-specific mount parameter string (cf. http://review.gluster.com/655). This commit fixes the internal API and the "ro" issue. It also adds a check for the "rw" and "ro" mount options in tests/basic/mount.t. Thanks to Csaba Henk (csaba@) for suggestions and proposing an updated patch. Change-Id: I7f7bf49ae44d148f5c16f10736a0e412fb8f5e67 BUG: 853895 Signed-off-by: Niels de Vos Reviewed-on: http://review.gluster.org/4163 Reviewed-by: Csaba Henk Tested-by: Gluster Build System --- xlators/mount/fuse/src/fuse-bridge.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'xlators/mount/fuse/src/fuse-bridge.c') diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c index 9be7d91c..544dec0c 100644 --- a/xlators/mount/fuse/src/fuse-bridge.c +++ b/xlators/mount/fuse/src/fuse-bridge.c @@ -4678,6 +4678,7 @@ init (xlator_t *this_xl) int fsname_allocated = 0; glusterfs_ctx_t *ctx = NULL; gf_boolean_t sync_to_mount = _gf_false; + unsigned long mntflags = 0; char *mnt_args = NULL; eh_t *event = NULL; @@ -4889,8 +4890,9 @@ init (xlator_t *this_xl) goto cleanup_exit; } - gf_asprintf (&mnt_args, "%s%s%s%sallow_other,max_read=131072", - priv->read_only ? "ro," : "", + if (priv->read_only) + mntflags |= MS_RDONLY; + gf_asprintf (&mnt_args, "%s%s%sallow_other,max_read=131072", priv->acl ? "" : "default_permissions,", priv->fuse_mountopts ? priv->fuse_mountopts : "", priv->fuse_mountopts ? "," : ""); @@ -4903,7 +4905,7 @@ init (xlator_t *this_xl) goto cleanup_exit; } - priv->fd = gf_fuse_mount (priv->mount_point, fsname, mnt_args, + priv->fd = gf_fuse_mount (priv->mount_point, fsname, mntflags, mnt_args, sync_to_mount ? &ctx->mnt_pid : NULL, priv->status_pipe[1]); if (priv->fd == -1) -- cgit