diff options
author | Niels de Vos <ndevos@redhat.com> | 2015-03-02 11:14:08 +0100 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2015-03-26 03:05:56 -0700 |
commit | 01d96d97f1bae4f83321285c701b93f2a668ad25 (patch) | |
tree | 33db5e6d2d91733c2dad5b5a97cfa8626b8a1b90 /xlators | |
parent | c8e095765c5ef72df9979f917b1b8e66cd8d0115 (diff) |
nfs: do not fail to start when optional RPC-programs fail to register
Some RPC-programs are not strictly required for the NFS-server. When
these optional protocols fail to get registered at the portmapper, there
is no need to fail the starting of the NFS-server.
Required RPC-programs:
- NFS
- MNT
Optional RPC-programs:
- NLM
- ACL
Change-Id: Ife8ad871cff47554e3f42eb457c76431d0181964
BUG: 1205579
Tested-by: Brad Hubbard <bhubbard@redhat.com>
Signed-off-by: Niels de Vos <ndevos@redhat.com>
Reviewed-on: http://review.gluster.org/9988
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Reviewed-by: soumya k <skoduri@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/nfs/server/src/nfs.c | 37 | ||||
-rw-r--r-- | xlators/nfs/server/src/nfs.h | 1 |
2 files changed, 24 insertions, 14 deletions
diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index 27dad2221a9..965aec7daa9 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -46,10 +46,12 @@ #define NFS_DATADIR GLUSTERD_DEFAULT_WORKDIR "/nfs" /* Forward declaration */ -int nfs_add_initer (struct list_head *list, nfs_version_initer_t init); +static int nfs_add_initer (struct list_head *list, nfs_version_initer_t init, + gf_boolean_t required); static int -nfs_init_version (xlator_t *this, nfs_version_initer_t init) +nfs_init_version (xlator_t *this, nfs_version_initer_t init, + gf_boolean_t required) { int ret = -1; struct nfs_initer_list *version = NULL; @@ -64,7 +66,7 @@ nfs_init_version (xlator_t *this, nfs_version_initer_t init) nfs = (struct nfs_state *)this->private; - ret = nfs_add_initer (&nfs->versions, init); + ret = nfs_add_initer (&nfs->versions, init, required); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to add protocol initializer"); @@ -163,7 +165,7 @@ nfs_reconfigure_acl3 (xlator_t *this) /* ACL is enabled */ if (nfs->enable_acl) - return nfs_init_version (this, acl3svc_init); + return nfs_init_version (this, acl3svc_init, _gf_false); /* ACL is disabled */ return nfs_deinit_version (nfs, acl3svc_init); @@ -181,7 +183,7 @@ nfs_reconfigure_nlm4 (xlator_t *this) /* NLM is enabled */ if (nfs->enable_nlm) - return nfs_init_version (this, nlm4svc_init); + return nfs_init_version (this, nlm4svc_init, _gf_false); /* NLM is disabled */ return nfs_deinit_version (nfs, nlm4svc_init); @@ -236,8 +238,9 @@ nfs_program_unregister_portmap_all (struct nfs_state *nfs) /* Every NFS version must call this function with the init function * for its particular version. */ -int -nfs_add_initer (struct list_head *list, nfs_version_initer_t init) +static int +nfs_add_initer (struct list_head *list, nfs_version_initer_t init, + gf_boolean_t required) { struct nfs_initer_list *new = NULL; if ((!list) || (!init)) @@ -250,6 +253,7 @@ nfs_add_initer (struct list_head *list, nfs_version_initer_t init) } new->init = init; + new->required = required; list_add_tail (&new->list, list); return 0; } @@ -327,9 +331,14 @@ nfs_init_versions (struct nfs_state *nfs, xlator_t *this) prog->progport); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, - "Program %s registration failed", + "%s program %s registration failed", + version->required ? + "Required" : "Optional", prog->progname); - goto err; + + /* fatal error if the program is required */ + if (version->required) + goto err; } } @@ -347,21 +356,21 @@ nfs_add_all_initiators (struct nfs_state *nfs) int ret = 0; /* Add the initializers for all versions. */ - ret = nfs_add_initer (&nfs->versions, mnt3svc_init); + ret = nfs_add_initer (&nfs->versions, mnt3svc_init, _gf_true); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to add " "MOUNT3 protocol initializer"); goto ret; } - ret = nfs_add_initer (&nfs->versions, mnt1svc_init); + ret = nfs_add_initer (&nfs->versions, mnt1svc_init, _gf_true); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to add " "MOUNT1 protocol initializer"); goto ret; } - ret = nfs_add_initer (&nfs->versions, nfs3svc_init); + ret = nfs_add_initer (&nfs->versions, nfs3svc_init, _gf_true); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to add " "NFS3 protocol initializer"); @@ -369,7 +378,7 @@ nfs_add_all_initiators (struct nfs_state *nfs) } if (nfs->enable_nlm == _gf_true) { - ret = nfs_add_initer (&nfs->versions, nlm4svc_init); + ret = nfs_add_initer (&nfs->versions, nlm4svc_init, _gf_false); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to add protocol" " initializer"); @@ -378,7 +387,7 @@ nfs_add_all_initiators (struct nfs_state *nfs) } if (nfs->enable_acl == _gf_true) { - ret = nfs_add_initer (&nfs->versions, acl3svc_init); + ret = nfs_add_initer (&nfs->versions, acl3svc_init, _gf_false); if (ret == -1) { gf_log (GF_NFS, GF_LOG_ERROR, "Failed to add " "ACL protocol initializer"); diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h index e2e5613d501..15aec5d7da9 100644 --- a/xlators/nfs/server/src/nfs.h +++ b/xlators/nfs/server/src/nfs.h @@ -61,6 +61,7 @@ struct nfs_initer_list { struct list_head list; nfs_version_initer_t init; rpcsvc_program_t *program; + gf_boolean_t required; }; struct nfs_state { |