diff options
author | Harshavardhana <harsha@harshavardhana.net> | 2014-04-17 15:54:34 -0700 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2014-04-24 14:41:48 -0700 |
commit | a3cb38e3edf005bef73da4c9cfd958474a14d50f (patch) | |
tree | a406029332a9eb096c14d441160bb670a42df8cb /xlators/nfs/server/src/nfs.c | |
parent | 9c13471b109587a639662fc690384285bee02bc6 (diff) |
build: MacOSX Porting fixes
git@forge.gluster.org:~schafdog/glusterfs-core/osx-glusterfs
Working functionality on MacOSX
- GlusterD (management daemon)
- GlusterCLI (management cli)
- GlusterFS FUSE (using OSXFUSE)
- GlusterNFS (without NLM - issues with rpc.statd)
Change-Id: I20193d3f8904388e47344e523b3787dbeab044ac
BUG: 1089172
Signed-off-by: Harshavardhana <harsha@harshavardhana.net>
Signed-off-by: Dennis Schafroth <dennis@schafroth.com>
Tested-by: Harshavardhana <harsha@harshavardhana.net>
Tested-by: Dennis Schafroth <dennis@schafroth.com>
Reviewed-on: http://review.gluster.org/7503
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/nfs/server/src/nfs.c')
-rw-r--r-- | xlators/nfs/server/src/nfs.c | 70 |
1 files changed, 58 insertions, 12 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index d962663bafa..918e8631255 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -35,12 +35,16 @@ #include "options.h" #include "acl3.h" #include "rpc-drc.h" +#include "syscall.h" #define STRINGIFY(val) #val #define TOSTRING(val) STRINGIFY(val) #define OPT_SERVER_AUX_GIDS "nfs.server-aux-gids" #define OPT_SERVER_GID_CACHE_TIMEOUT "nfs.server.aux-gid-timeout" +#define OPT_SERVER_RPC_STATD "nfs.rpc-statd" +#define OPT_SERVER_RPC_STATD_PIDFILE "nfs.rpc-statd-pidfile" +#define OPT_SERVER_RPC_STATD_NOTIFY_PIDFILE "nfs.rpc-statd-notify-pidfile" /* TODO: DATADIR should be based on configure's $(localstatedir) */ #define DATADIR "/var/lib/glusterd" @@ -942,10 +946,14 @@ nfs_init_state (xlator_t *this) goto free_foppool; } } + GF_OPTION_INIT (OPT_SERVER_RPC_STATD, nfs->rpc_statd, path, free_foppool); + + GF_OPTION_INIT (OPT_SERVER_RPC_STATD_PIDFILE, nfs->rpc_statd_pid_file, path, free_foppool); GF_OPTION_INIT (OPT_SERVER_AUX_GIDS, nfs->server_aux_gids, bool, free_foppool); - GF_OPTION_INIT (OPT_SERVER_GID_CACHE_TIMEOUT, nfs->server_aux_gids_max_age, + GF_OPTION_INIT (OPT_SERVER_GID_CACHE_TIMEOUT, + nfs->server_aux_gids_max_age, uint32, free_foppool); if (gid_cache_init(&nfs->gid_cache, nfs->server_aux_gids_max_age) < 0) { @@ -953,9 +961,17 @@ nfs_init_state (xlator_t *this) goto free_foppool; } - if (stat("/sbin/rpc.statd", &stbuf) == -1) { - gf_log (GF_NFS, GF_LOG_WARNING, "/sbin/rpc.statd not found. " - "Disabling NLM"); + ret = sys_access (nfs->rpc_statd, X_OK); + if (ret) { + gf_log (GF_NFS, GF_LOG_WARNING, "%s not enough permissions to" + " access. Disabling NLM", nfs->rpc_statd); + nfs->enable_nlm = _gf_false; + } + + ret = sys_stat (nfs->rpc_statd, &stbuf); + if (ret || !S_ISREG (stbuf.st_mode)) { + gf_log (GF_NFS, GF_LOG_WARNING, "%s not a regular file." + " Disabling NLM", nfs->rpc_statd); nfs->enable_nlm = _gf_false; } @@ -968,8 +984,8 @@ nfs_init_state (xlator_t *this) } ret = rpcsvc_set_outstanding_rpc_limit (nfs->rpcsvc, - this->options, - RPCSVC_DEF_NFS_OUTSTANDING_RPC_LIMIT); + this->options, + RPCSVC_DEF_NFS_OUTSTANDING_RPC_LIMIT); if (ret < 0) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to configure outstanding-rpc-limit"); @@ -1023,7 +1039,8 @@ nfs_reconfigure_state (xlator_t *this, dict_t *options) { int ret = 0; int keyindx = 0; - char *optstr = NULL; + char *rmtab = NULL; + char *rpc_statd = NULL; gf_boolean_t optbool; uint32_t optuint32; struct nfs_state *nfs = NULL; @@ -1068,19 +1085,36 @@ nfs_reconfigure_state (xlator_t *this, dict_t *options) goto out; } + /* reconfig nfs.rpc-statd... */ + rpc_statd = GF_RPC_STATD_PROG; + if (dict_get (options, OPT_SERVER_RPC_STATD_PIDFILE)) { + ret = dict_get_str (options, "nfs.rpc-statd", &rpc_statd); + if (ret < 0) { + gf_log (GF_NFS, GF_LOG_ERROR, "Failed to read " + "reconfigured option: nfs.rpc-statd"); + goto out; + } + } + + if (strcmp(nfs->rpc_statd, rpc_statd) != 0) { + gf_log (GF_NFS, GF_LOG_INFO, + "Reconfiguring nfs.rpc-statd needs NFS restart"); + goto out; + } + /* reconfig nfs.mount-rmtab */ - optstr = NFS_DATADIR "/rmtab"; + rmtab = NFS_DATADIR "/rmtab"; if (dict_get (options, "nfs.mount-rmtab")) { - ret = dict_get_str (options, "nfs.mount-rmtab", &optstr); + ret = dict_get_str (options, "nfs.mount-rmtab", &rmtab); if (ret < 0) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to read " "reconfigured option: nfs.mount-rmtab"); goto out; } - gf_path_strip_trailing_slashes (optstr); + gf_path_strip_trailing_slashes (rmtab); } - if (strcmp (nfs->rmtab, optstr) != 0) { - mount_rewrite_rmtab (nfs->mstate, optstr); + if (strcmp (nfs->rmtab, rmtab) != 0) { + mount_rewrite_rmtab (nfs->mstate, rmtab); gf_log (GF_NFS, GF_LOG_INFO, "Reconfigured nfs.mount-rmtab path: %s", nfs->rmtab); @@ -1819,6 +1853,18 @@ struct volume_options options[] = { "storage, all GlusterFS servers will update and " "output (with 'showmount') the same list." }, + { .key = {OPT_SERVER_RPC_STATD}, + .type = GF_OPTION_TYPE_PATH, + .default_value = GF_RPC_STATD_PROG, + .description = "The executable of RPC statd utility. " + "Defaults to " GF_RPC_STATD_PROG + }, + { .key = {OPT_SERVER_RPC_STATD_PIDFILE}, + .type = GF_OPTION_TYPE_PATH, + .default_value = GF_RPC_STATD_PIDFILE, + .description = "The pid file of RPC statd utility. " + "Defaults to " GF_RPC_STATD_PIDFILE + }, { .key = {OPT_SERVER_AUX_GIDS}, .type = GF_OPTION_TYPE_BOOL, .default_value = "off", |