diff options
Diffstat (limited to 'xlators/nfs/server/src/nfs.c')
| -rw-r--r-- | xlators/nfs/server/src/nfs.c | 65 | 
1 files changed, 65 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index 49512438ec7..831e82a8ca1 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -51,6 +51,10 @@  #define OPT_SERVER_AUX_GIDS             "nfs.server-aux-gids"  #define OPT_SERVER_GID_CACHE_TIMEOUT    "nfs.server.aux-gid-timeout" +/* TODO: DATADIR should be based on configure's $(localstatedir) */ +#define DATADIR                         "/var/lib/glusterd" +#define NFS_DATADIR                     DATADIR "/nfs" +  /* Every NFS version must call this function with the init function   * for its particular version.   */ @@ -696,6 +700,15 @@ nfs_init_state (xlator_t *this)                          nfs->mount_udp = 1;          } +        nfs->rmtab = NFS_DATADIR "/rmtab"; +        if (dict_get(this->options, "nfs.mount-rmtab")) { +                ret = dict_get_str (this->options, "nfs.mount-rmtab", &nfs->rmtab); +                if (ret == -1) { +                        gf_log (GF_NFS, GF_LOG_ERROR, "Failed to parse dict"); +                        goto free_foppool; +                } +        } +          /* support both options rpc-auth.ports.insecure and           * rpc-auth-allow-insecure for backward compatibility           */ @@ -816,6 +829,49 @@ nfs_drc_init (xlator_t *this)          return ret;  } + +#if 0 +/* reconfigure() is currently not used for the NFS-server. Upon setting an + * option for the NFS-xlator, the glusterfs process it restarted. + * + * This current implementation makes sure to read the currently used rmtab and + * merge it with the new rmtab. + * + * As this function is never called, it is provided for the future, for when + * the NFS-server supports reloading. + */ +int +reconfigure (xlator_t *this, dict_t *options) +{ +        int                       ret = 0; +        char                     *rmtab = NULL; +        struct nfs_state         *nfs = NULL; + +        nfs = (struct nfs_state *)this->private; + +        if (!nfs) { +                gf_log_callingfn (this->name, GF_LOG_DEBUG, "conf == null!!!"); +                goto out; +        } + +        ret = dict_get_str (options, "nfs.mount-rmtab", &rmtab); +        if (ret) { +                goto out; +        } +        gf_path_strip_trailing_slashes (rmtab); + +        if (strcmp (nfs->rmtab, rmtab) != 0) { +                mount_rewrite_rmtab (nfs->mstate, rmtab); + +                gf_log (this->name, GF_LOG_INFO, +                        "Reconfigured nfs.mount-rmtab path: %s", nfs->rmtab); +        } + +out: +        return ret; +} +#endif /* glusterfs/nfs is restarted and reconfigure() is never called */ +  int  init (xlator_t *this) { @@ -1337,6 +1393,15 @@ struct volume_options options[] = {                           "The need for enabling this option often depends "                           "on the usage of NLM."          }, +        { .key = {"nfs.mount-rmtab"}, +          .type = GF_OPTION_TYPE_PATH, +          .default_value = DATADIR "/rmtab", +          .description = "Set the location of the cache file that is used to " +                         "list all the NFS-clients that have connected " +                         "through the MOUNT protocol. If this is on shared " +                         "storage, all GlusterFS servers will update and " +                         "output (with 'showmount') the same list." +        },          { .key = {OPT_SERVER_AUX_GIDS},            .type = GF_OPTION_TYPE_BOOL,            .default_value = "off",  | 
