summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLubomir Rintel <lubo.rintel@gooddata.com>2012-08-29 14:55:13 +0200
committerAnand Avati <avati@redhat.com>2012-09-12 14:39:06 -0700
commitab039cc10f8493c6964ddc5b1510219708a31c60 (patch)
tree9b71740885cb876389c129073ed65e0ea9e00a3b
parent4f87fd0ae2ce629576ca5f647a99888d31a46815 (diff)
fuse-bridge: Pass unknown option down to fuse
In Linux, certain "filesystem-specific" options (passed in string form in last argument to mount(2)), such as "rootcontext" or "context" are in fact common to all filesystems, including fuse. We should pass them down to the actual mount(2) call untouched. This is achieved by adding "fuse-mountopts" option to mount/fuse translator and adjusting the mount helper to propagate it with unrecognized options as they are encountered. BUG: 852754 Change-Id: I309203090c02025334561be235864d8d04e4159b Signed-off-by: Lubomir Rintel <lubo.rintel@gooddata.com> Reviewed-on: http://review.gluster.org/3871 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
-rw-r--r--glusterfsd/src/glusterfsd.c17
-rw-r--r--glusterfsd/src/glusterfsd.h1
-rw-r--r--libglusterfs/src/glusterfs.h2
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c11
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.h1
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in16
6 files changed, 44 insertions, 4 deletions
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 2c19e680f99..621cc47bc0c 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -196,6 +196,8 @@ static struct argp_option gf_options[] = {
"Enable strict volume file checking"},
{"mem-accounting", ARGP_MEM_ACCOUNTING_KEY, 0, OPTION_HIDDEN,
"Enable internal memory accounting"},
+ {"fuse-mountopts", ARGP_FUSE_MOUNTOPTS_KEY, "OPTIONS", OPTION_HIDDEN,
+ "Extra mount options to pass to FUSE"},
{0, 0, 0, 0, "Miscellaneous Options:"},
{0, }
};
@@ -489,6 +491,17 @@ create_fuse_mount (glusterfs_ctx_t *ctx)
if (ret)
goto err;
+ if (cmd_args->fuse_mountopts) {
+ ret = dict_set_static_ptr (master->options, ZR_FUSE_MOUNTOPTS,
+ cmd_args->fuse_mountopts);
+ if (ret < 0) {
+ gf_log ("glusterfsd", GF_LOG_ERROR,
+ "failed to set dict value for key %s",
+ ZR_FUSE_MOUNTOPTS);
+ goto err;
+ }
+ }
+
ret = xlator_init (master);
if (ret) {
gf_log ("", GF_LOG_DEBUG, "failed to initialize fuse translator");
@@ -932,6 +945,10 @@ parse_opts (int key, char *arg, struct argp_state *state)
argp_failure (state, -1, 0,
"unknown congestion threshold option %s", arg);
break;
+
+ case ARGP_FUSE_MOUNTOPTS_KEY:
+ cmd_args->fuse_mountopts = gf_strdup (arg);
+ break;
}
return 0;
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
index dab7f04181d..483a21757f6 100644
--- a/glusterfsd/src/glusterfsd.h
+++ b/glusterfsd/src/glusterfsd.h
@@ -84,6 +84,7 @@ enum argp_option_keys {
ARGP_FUSE_BACKGROUND_QLEN_KEY = 161,
ARGP_FUSE_CONGESTION_THRESHOLD_KEY = 162,
ARGP_INODE32_KEY = 163,
+ ARGP_FUSE_MOUNTOPTS_KEY = 164,
};
struct _gfd_vol_top_priv_t {
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 68d9bbc95da..57bc7998ff2 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -76,6 +76,7 @@
#define ZR_DIRECT_IO_OPT "direct-io-mode"
#define ZR_STRICT_VOLFILE_CHECK "strict-volfile-check"
#define ZR_DUMP_FUSE "dump-fuse"
+#define ZR_FUSE_MOUNTOPTS "fuse-mountopts"
#define GF_XATTR_CLRLK_CMD "glusterfs.clrlk"
#define GF_XATTR_PATHINFO_KEY "trusted.glusterfs.pathinfo"
@@ -318,6 +319,7 @@ struct _cmd_args {
unsigned uid_map_root;
int background_qlen;
int congestion_threshold;
+ char *fuse_mountopts;
/* key args */
char *mount_point;
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 726e500e9e4..f9d3846207c 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -4655,6 +4655,8 @@ init (xlator_t *this_xl)
GF_OPTION_INIT("gid-timeout", priv->gid_cache_timeout, int32,
cleanup_exit);
+ GF_OPTION_INIT ("fuse-mountopts", priv->fuse_mountopts, str, cleanup_exit);
+
if (gid_cache_init(&priv->gid_cache, priv->gid_cache_timeout) < 0) {
gf_log("glusterfs-fuse", GF_LOG_ERROR, "Failed to initialize "
"group cache.");
@@ -4716,9 +4718,11 @@ init (xlator_t *this_xl)
goto cleanup_exit;
}
- gf_asprintf (&mnt_args, "%s%sallow_other,max_read=131072",
+ gf_asprintf (&mnt_args, "%s%s%s%sallow_other,max_read=131072",
priv->read_only ? "ro," : "",
- priv->acl ? "" : "default_permissions,");
+ priv->acl ? "" : "default_permissions,",
+ priv->fuse_mountopts ? priv->fuse_mountopts : "",
+ priv->fuse_mountopts ? "," : "");
if (!mnt_args)
goto cleanup_exit;
@@ -4886,5 +4890,8 @@ struct volume_options options[] = {
.min = 12,
.max = (64 * GF_UNIT_KB),
},
+ { .key = {"fuse-mountopts"},
+ .type = GF_OPTION_TYPE_STR
+ },
{ .key = {NULL} },
};
diff --git a/xlators/mount/fuse/src/fuse-bridge.h b/xlators/mount/fuse/src/fuse-bridge.h
index 3f45f064463..7db9d653c25 100644
--- a/xlators/mount/fuse/src/fuse-bridge.h
+++ b/xlators/mount/fuse/src/fuse-bridge.h
@@ -107,6 +107,7 @@ struct fuse_private {
gf_boolean_t enable_ino32;
fdtable_t *fdtable;
gid_cache_t gid_cache;
+ char *fuse_mountopts;
/* For fuse-reverse-validation */
int revchan_in;
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index 9b9c0f81b6f..0d92bfbd595 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -156,6 +156,10 @@ start_glusterfs ()
cmd_line=$(echo "$cmd_line --congestion-threshold=$cong_threshold");
fi
+ if [ -n "$fuse_mountopts" ]; then
+ cmd_line=$(echo "$cmd_line --fuse-mountopts=$fuse_mountopts");
+ fi
+
# for rdma volume, we have to fetch volfile with '.rdma' added
# to volume name, so that it fetches the right client vol file
volume_id_rdma="";
@@ -190,6 +194,10 @@ start_glusterfs ()
cmd_line=$(echo "$cmd_line --volfile=$volfile_loc");
fi
+ if [ -n "$fuse_mountopts" ]; then
+ cmd_line=$(echo "$cmd_line --fuse-mountopts=$fuse_mountopts");
+ fi
+
cmd_line=$(echo "$cmd_line $mount_point");
err=0;
$cmd_line;
@@ -353,7 +361,12 @@ main ()
"gid-timeout") gid_timeout=$value ;;
"background-qlen") bg_qlen=$value ;;
"congestion-threshold") cong_threshold=$value ;;
- *) echo "unknown option $key (ignored)" ;;
+ "fuse-mountopts") fuse_mountopts=$value ;;
+ *)
+ # Passthru
+ [ -z "$fuse_mountopts" ] || fuse_mountopts="$fuse_mountopts,"
+ fuse_mountopts="$fuse_mountopts$pair"
+ ;;
esac
esac
done
@@ -422,4 +435,3 @@ main ()
}
_init "$@" && main "$@";
-