From f62a8026be3875afd38fb1899e1fa235c8f1a6fb Mon Sep 17 00:00:00 2001 From: Brian Foster Date: Mon, 16 Jul 2012 13:51:09 -0400 Subject: libglusterfs,mount/fuse: implement gidcache mechanism in fuse-bridge This change genericizes the cache mechanism implemented in commit 8efd2845 into libglusterfs/src/gidcache.[ch] and adds fuse-bridge as a client. The cache mechanism is fundamentally equivalent, with some minor changes: - Change cache key from uid_t to uint64_t. - Modify the cache add logic to locate and use an entry with a matching ID, should it already exist. This addresses a bug in the existing mechanism where an expired entry supercedes a newly added entry in lookup, causing repeated adds and flushing of a cache bucket. The fuse group cache is disabled by default. It can be enabled via the 'gid-timeout' fuse-bridge translator option and accompanying mount option (i.e., '-o gid-timeout=1' for a 1s entry timeout). BUG: 800892 Change-Id: I0b34a2263ca48dbb154790a4a44fc70b733e9114 Signed-off-by: Brian Foster Reviewed-on: https://code.engineering.redhat.com/gerrit/1853 Reviewed-by: Vijay Bellur Tested-by: Vijay Bellur --- glusterfsd/src/glusterfsd.c | 22 +++++++++++++++++++++- glusterfsd/src/glusterfsd.h | 1 + 2 files changed, 22 insertions(+), 1 deletion(-) (limited to 'glusterfsd') diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c index 90f12e9f77b..9e21204929f 100644 --- a/glusterfsd/src/glusterfsd.c +++ b/glusterfsd/src/glusterfsd.c @@ -182,6 +182,9 @@ static struct argp_option gf_options[] = { {"attribute-timeout", ARGP_ATTRIBUTE_TIMEOUT_KEY, "SECONDS", 0, "Set attribute timeout to SECONDS for inodes in fuse kernel module " "[default: 1]"}, + {"gid-timeout", ARGP_GID_TIMEOUT_KEY, "SECONDS", 0, + "Set auxilary group list timeout to SECONDS for fuse translator " + "[default: 0]"}, {"client-pid", ARGP_CLIENT_PID_KEY, "PID", OPTION_HIDDEN, "client will authenticate itself with process id PID to server"}, {"user-map-root", ARGP_USER_MAP_ROOT_KEY, "USER", OPTION_HIDDEN, @@ -382,6 +385,16 @@ create_fuse_mount (glusterfs_ctx_t *ctx) } } + if (cmd_args->gid_timeout) { + ret = dict_set_int32(master->options, "gid-timeout", + cmd_args->gid_timeout); + if (ret < 0) { + gf_log("glusterfsd", GF_LOG_ERROR, "failed to set dict " + "value for key gid-timeout"); + goto err; + } + } + switch (cmd_args->fuse_direct_io_mode) { case GF_OPTION_DISABLE: /* disable */ ret = dict_set_static_ptr (master->options, ZR_DIRECT_IO_OPT, @@ -828,7 +841,14 @@ parse_opts (int key, char *arg, struct argp_state *state) ctx = glusterfs_ctx_get (); ctx->mem_accounting = 1; break; - } + + case ARGP_GID_TIMEOUT_KEY: + if (!gf_string2int(arg, &cmd_args->gid_timeout)) + break; + + argp_failure(state, -1, 0, "unknown group list timeout %s", arg); + break; + } return 0; } diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h index e832b87a21a..03585cf22ee 100644 --- a/glusterfsd/src/glusterfsd.h +++ b/glusterfsd/src/glusterfsd.h @@ -89,6 +89,7 @@ enum argp_option_keys { ARGP_SELINUX_KEY = 158, /* glusterfs upstream includes options 159-162, but we dont */ ARGP_INODE32_KEY = 159, /* 163 upstream */ + ARGP_GID_TIMEOUT_KEY = 160, }; struct _gfd_vol_top_priv_t { -- cgit