summaryrefslogtreecommitdiffstats
path: root/xlators/nfs
diff options
context:
space:
mode:
authorRajesh Amaravathi <rajesh@redhat.com>2012-04-16 12:05:45 +0530
committerVijay Bellur <vijay@gluster.com>2012-04-17 06:29:49 -0700
commitb69f0110410c670eb6c31b6669d47ec2aaeb92f4 (patch)
tree715919178150f772f674e920d864b621b3ccd370 /xlators/nfs
parentc20f501d0632d6105f0d570ac8dec251974ebe87 (diff)
nfs: option to disable NLM
Adding support to disable/enable nlm with the following command: # gluster volume set <VOLNAME> nfs.nlm [on|off] Change-Id: I1ad3e44c5d4349d0f3463bfca0995fd10def39dd BUG: 812869 Signed-off-by: Rajesh Amaravathi <rajesh@redhat.com> Reviewed-on: http://review.gluster.com/3160 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishna Srinivas <krishna@gluster.com>
Diffstat (limited to 'xlators/nfs')
-rw-r--r--xlators/nfs/server/src/nfs.c36
-rw-r--r--xlators/nfs/server/src/nfs.h1
2 files changed, 32 insertions, 5 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c
index f2c690994..d4feded24 100644
--- a/xlators/nfs/server/src/nfs.c
+++ b/xlators/nfs/server/src/nfs.c
@@ -173,11 +173,15 @@ nfs_add_all_initiators (struct nfs_state *nfs)
goto ret;
}
- ret = nfs_add_initer (&nfs->versions, nlm4svc_init);
- if (ret == -1) {
- gf_log (GF_NFS, GF_LOG_ERROR, "Failed to add protocol"
- " initializer");
- goto ret;
+ if (nfs->enable_nlm == _gf_true) {
+ ret = nfs_add_initer (&nfs->versions, nlm4svc_init);
+ if (ret == -1) {
+ gf_log (GF_NFS, GF_LOG_ERROR, "Failed to add protocol"
+ " initializer");
+ goto ret;
+ }
+ } else {
+ gf_log (GF_NFS, GF_LOG_INFO, "NLM is manually disabled");
}
ret = 0;
@@ -570,6 +574,20 @@ nfs_init_state (xlator_t *this)
nfs->dynamicvolumes = GF_NFS_DVM_ON;
}
+ nfs->enable_nlm = _gf_true;
+ if (!dict_get_str (this->options, "nfs.nlm", &optstr)) {
+
+ ret = gf_string2boolean (optstr, &boolt);
+ if (ret < 0) {
+ gf_log (GF_NFS, GF_LOG_ERROR, "Failed to parse"
+ " bool string");
+ goto free_foppool;
+ }
+
+ if (boolt == _gf_false)
+ nfs->enable_nlm = _gf_false;
+ }
+
nfs->enable_ino32 = 0;
if (dict_get (this->options, "nfs.enable-ino32")) {
ret = dict_get_str (this->options, "nfs.enable-ino32",
@@ -1145,6 +1163,14 @@ struct volume_options options[] = {
.description = "This option is used to start or stop NFS server"
"for individual volume."
},
+
+ { .key = {"nfs.nlm"},
+ .type = GF_OPTION_TYPE_BOOL,
+ .description = "This option, if set to 'off', disables NLM server "
+ "by not registering the service with the portmapper."
+ " Set it to 'on' to re-enable it. Default value: 'on'"
+ },
+
{ .key = {NULL} },
};
diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h
index 706cba86f..0c9721244 100644
--- a/xlators/nfs/server/src/nfs.h
+++ b/xlators/nfs/server/src/nfs.h
@@ -85,6 +85,7 @@ struct nfs_state {
int enable_ino32;
unsigned int override_portnum;
int allow_insecure;
+ int enable_nlm;
struct rpc_clnt *rpc_clnt;
};