diff options
Diffstat (limited to 'xlators/nfs/server/src/nfs.c')
| -rw-r--r-- | xlators/nfs/server/src/nfs.c | 71 |
1 files changed, 51 insertions, 20 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index a20fab3ef79..39b73f88ac3 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -12,25 +12,26 @@ * Every other protocol version gets initialized from here. */ -#include "defaults.h" +#include <glusterfs/defaults.h> #include "rpcsvc.h" -#include "dict.h" -#include "xlator.h" +#include <glusterfs/dict.h> +#include <glusterfs/xlator.h> #include "nfs.h" -#include "mem-pool.h" -#include "logging.h" +#include <glusterfs/mem-pool.h> +#include <glusterfs/logging.h> #include "nfs-fops.h" #include "mount3.h" #include "nfs3.h" #include "nfs-mem-types.h" #include "nfs3-helpers.h" #include "nlm4.h" -#include "options.h" +#include <glusterfs/options.h> #include "acl3.h" #include "rpc-drc.h" -#include "syscall.h" +#include <glusterfs/syscall.h> #include "rpcsvc.h" #include "nfs-messages.h" +#include "glusterfs/statedump.h" #define OPT_SERVER_AUX_GIDS "nfs.server-aux-gids" #define OPT_SERVER_GID_CACHE_TIMEOUT "nfs.server.aux-gid-timeout" @@ -1114,7 +1115,7 @@ nfs_init_state(xlator_t *this) GF_OPTION_INIT("nfs.event-threads", nfs->event_threads, uint32, free_foppool); - event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); + gf_event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); this->private = (void *)nfs; INIT_LIST_HEAD(&nfs->versions); @@ -1156,7 +1157,7 @@ out: return ret; } -int +static int nfs_reconfigure_state(xlator_t *this, dict_t *options) { int ret = 0; @@ -1166,8 +1167,8 @@ nfs_reconfigure_state(xlator_t *this, dict_t *options) gf_boolean_t optbool; uint32_t optuint32; struct nfs_state *nfs = NULL; - char *blacklist_keys[] = {"nfs.port", "nfs.transport-type", - "nfs.mem-factor", NULL}; + static char *options_require_restart[] = {"nfs.port", "nfs.transport-type", + "nfs.mem-factor", NULL}; GF_VALIDATE_OR_GOTO(GF_NFS, this, out); GF_VALIDATE_OR_GOTO(GF_NFS, this->private, out); @@ -1175,14 +1176,14 @@ nfs_reconfigure_state(xlator_t *this, dict_t *options) nfs = (struct nfs_state *)this->private; - /* Black listed options can't be reconfigured, they need + /* Some listed options can't be reconfigured, they need * NFS to be restarted. There are two cases 1. SET 2. UNSET. * 1. SET */ - while (blacklist_keys[keyindx]) { - if (dict_get(options, blacklist_keys[keyindx])) { + while (options_require_restart[keyindx]) { + if (dict_get(options, options_require_restart[keyindx])) { gf_msg(GF_NFS, GF_LOG_ERROR, 0, NFS_MSG_RECONFIG_FAIL, "Reconfiguring %s needs NFS restart", - blacklist_keys[keyindx]); + options_require_restart[keyindx]); goto out; } keyindx++; @@ -1337,7 +1338,7 @@ nfs_reconfigure_state(xlator_t *this, dict_t *options) GF_OPTION_RECONF("nfs.event-threads", nfs->event_threads, options, uint32, out); - event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); + gf_event_reconfigure_threads(this->ctx->event_pool, nfs->event_threads); ret = 0; out: @@ -1529,7 +1530,7 @@ notify(xlator_t *this, int32_t event, void *data, ...) return 0; } -int +void fini(xlator_t *this) { struct nfs_state *nfs = NULL; @@ -1539,7 +1540,7 @@ fini(xlator_t *this) gf_msg_debug(GF_NFS, 0, "NFS service going down"); nfs_deinit_versions(&nfs->versions, this); GF_FREE(this->instance_name); - return 0; + return; } int32_t @@ -1551,7 +1552,7 @@ nfs_forget(xlator_t *this, inode_t *inode) if (inode_ctx_del(inode, this, &ctx)) return -1; - ictx = (struct nfs_inode_ctx *)ctx; + ictx = (struct nfs_inode_ctx *)(uintptr_t)ctx; GF_FREE(ictx); return 0; @@ -1667,6 +1668,20 @@ out: return ret; } +int32_t +nfs_itable_dump(xlator_t *this) +{ + if (!this) + return -1; + + if (this->next && this->next->itable) { + gf_proc_dump_add_section("xlator.nfs.itable"); + inode_table_dump(this->next->itable, "xlator.nfs.itable"); + } + + return 0; +} + struct xlator_cbks cbks = { .forget = nfs_forget, }; @@ -1676,6 +1691,7 @@ struct xlator_fops fops; struct xlator_dumpops dumpops = { .priv = nfs_priv, .priv_to_dict = nfs_priv_to_dict, + .inode = nfs_itable_dump, }; /* TODO: If needed, per-volume options below can be extended to be export @@ -2030,7 +2046,7 @@ struct volume_options options[] = { .type = GF_OPTION_TYPE_SIZET, .min = 1, .max = 32, - .default_value = "1", + .default_value = "2", .description = "Specifies the number of event threads to execute in" "in parallel. Larger values would help process" " responses faster, depending on available processing" @@ -2040,3 +2056,18 @@ struct volume_options options[] = { }, {.key = {NULL}}, }; + +xlator_api_t xlator_api = { + .init = init, + .fini = fini, + .notify = notify, + .reconfigure = reconfigure, + .mem_acct_init = mem_acct_init, + .op_version = {1}, + .dumpops = &dumpops, + .fops = &fops, + .cbks = &cbks, + .options = options, + .identifier = "gnfs", + .category = GF_MAINTAINED, +}; |
