From 00e247ee44067f2b3e7ca5f7e6dc2f7934c97181 Mon Sep 17 00:00:00 2001 From: Santosh Kumar Pradhan Date: Wed, 9 Apr 2014 10:19:43 +0530 Subject: gNFS: Support wildcard in RPC auth allow/reject RFE: Support wildcard in "nfs.rpc-auth-allow" and "nfs.rpc-auth-reject". e.g. *.redhat.com 192.168.1[1-5].* 192.168.1[1-5].*, *.redhat.com, 192.168.21.9 Along with wildcard, support for subnetwork or IP range e.g. 192.168.10.23/24 The option will be validated for following categories: 1) Anonymous i.e. "*" 2) Wildcard pattern i.e. string containing any ('*', '?', '[') 3) IPv4 address 4) IPv6 address 5) FQDN 6) subnetwork or IPv4 range Currently this does not support IPv6 subnetwork. Change-Id: Iac8caf5e490c8174d61111dad47fd547d4f67bf4 BUG: 1086097 Signed-off-by: Santosh Kumar Pradhan Reviewed-on: http://review.gluster.org/7485 Reviewed-by: Poornima G Reviewed-by: Harshavardhana Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/nfs/server/src/nfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'xlators/nfs/server') diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index 04cf030dc..d962663ba 100644 --- a/xlators/nfs/server/src/nfs.c +++ b/xlators/nfs/server/src/nfs.c @@ -1665,7 +1665,7 @@ struct volume_options options[] = { "unrecognized option warnings." }, { .key = {"rpc-auth.addr.allow"}, - .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST, + .type = GF_OPTION_TYPE_CLIENT_AUTH_ADDR, .default_value = "all", .description = "Allow a comma separated list of addresses and/or" " hostnames to connect to the server. By default, all" @@ -1673,7 +1673,7 @@ struct volume_options options[] = { "define a general rule for all exported volumes." }, { .key = {"rpc-auth.addr.reject"}, - .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST, + .type = GF_OPTION_TYPE_CLIENT_AUTH_ADDR, .default_value = "none", .description = "Reject a comma separated list of addresses and/or" " hostnames from connecting to the server. By default," @@ -1681,7 +1681,7 @@ struct volume_options options[] = { "define a general rule for all exported volumes." }, { .key = {"rpc-auth.addr.*.allow"}, - .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST, + .type = GF_OPTION_TYPE_CLIENT_AUTH_ADDR, .default_value = "all", .description = "Allow a comma separated list of addresses and/or" " hostnames to connect to the server. By default, all" @@ -1689,7 +1689,7 @@ struct volume_options options[] = { "define a rule for a specific exported volume." }, { .key = {"rpc-auth.addr.*.reject"}, - .type = GF_OPTION_TYPE_INTERNET_ADDRESS_LIST, + .type = GF_OPTION_TYPE_CLIENT_AUTH_ADDR, .default_value = "none", .description = "Reject a comma separated list of addresses and/or" " hostnames from connecting to the server. By default," -- cgit From a3cb38e3edf005bef73da4c9cfd958474a14d50f Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Thu, 17 Apr 2014 15:54:34 -0700 Subject: 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 Signed-off-by: Dennis Schafroth Tested-by: Harshavardhana Tested-by: Dennis Schafroth Reviewed-on: http://review.gluster.org/7503 Tested-by: Gluster Build System Reviewed-by: Anand Avati --- xlators/nfs/server/src/nfs-fops.c | 11 ++++-- xlators/nfs/server/src/nfs.c | 70 +++++++++++++++++++++++++++++------ xlators/nfs/server/src/nfs.h | 2 + xlators/nfs/server/src/nfs3-helpers.c | 4 +- xlators/nfs/server/src/nfs3.c | 6 +-- xlators/nfs/server/src/nlm4.c | 38 ++++++++++++++----- xlators/nfs/server/src/nlm4.h | 9 +++++ 7 files changed, 110 insertions(+), 30 deletions(-) (limited to 'xlators/nfs/server') diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c index b91f73a53..56d4cba47 100644 --- a/xlators/nfs/server/src/nfs-fops.c +++ b/xlators/nfs/server/src/nfs-fops.c @@ -38,20 +38,25 @@ nfs_fix_groups (xlator_t *this, call_stack_t *root) struct passwd mypw; char mystrs[1024]; struct passwd *result; +#ifdef GF_DARWIN_HOST_OS + /* BSD/DARWIN does not correctly uses gid_t in getgrouplist */ + int mygroups[GF_MAX_AUX_GROUPS]; +#else gid_t mygroups[GF_MAX_AUX_GROUPS]; +#endif int ngroups; int i; int max_groups; struct nfs_state *priv = this->private; const gid_list_t *agl; - gid_list_t gl; + gid_list_t gl; if (!priv->server_aux_gids) { return; } - /* RPC enforces the GF_AUTH_GLUSTERFS_MAX_GROUPS limit */ - max_groups = GF_AUTH_GLUSTERFS_MAX_GROUPS(root->lk_owner.len); + /* RPC enforces the GF_AUTH_GLUSTERFS_MAX_GROUPS limit */ + max_groups = GF_AUTH_GLUSTERFS_MAX_GROUPS(root->lk_owner.len); agl = gid_cache_lookup(&priv->gid_cache, root->uid, 0, 0); if (agl) { diff --git a/xlators/nfs/server/src/nfs.c b/xlators/nfs/server/src/nfs.c index d962663ba..918e86312 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", diff --git a/xlators/nfs/server/src/nfs.h b/xlators/nfs/server/src/nfs.h index 00c7f8046..fc745fbbd 100644 --- a/xlators/nfs/server/src/nfs.h +++ b/xlators/nfs/server/src/nfs.h @@ -86,6 +86,8 @@ struct nfs_state { gid_cache_t gid_cache; uint32_t generation; gf_boolean_t register_portmap; + char *rpc_statd; + char *rpc_statd_pid_file; }; struct nfs_inode_ctx { diff --git a/xlators/nfs/server/src/nfs3-helpers.c b/xlators/nfs/server/src/nfs3-helpers.c index 9059fc341..f67cccf1a 100644 --- a/xlators/nfs/server/src/nfs3-helpers.c +++ b/xlators/nfs/server/src/nfs3-helpers.c @@ -85,7 +85,7 @@ struct nfs3stat_strerror nfs3stat_strerror_table[] = { { NFS3ERR_SERVERFAULT, "Error occurred on the server or IO Error" }, { NFS3ERR_BADTYPE, "Type not supported by the server" }, { NFS3ERR_JUKEBOX, "Cannot complete server initiated request" }, - { -1, "IO Error" }, + { NFS3ERR_END_OF_LIST, "IO Error" }, }; @@ -543,7 +543,7 @@ char * nfsstat3_strerror(int stat) { int i; - for(i = 0; nfs3stat_strerror_table[i].stat != -1; i++) { + for(i = 0; nfs3stat_strerror_table[i].stat != NFS3ERR_END_OF_LIST ; i++) { if (nfs3stat_strerror_table[i].stat == stat) return nfs3stat_strerror_table[i].strerror; } diff --git a/xlators/nfs/server/src/nfs3.c b/xlators/nfs/server/src/nfs3.c index 0fea135c7..6361f9e20 100644 --- a/xlators/nfs/server/src/nfs3.c +++ b/xlators/nfs/server/src/nfs3.c @@ -5186,7 +5186,7 @@ nfs3_init_options (struct nfs3_state *nfs3, dict_t *options) goto err; } - ret = gf_string2bytesize (optstr, &size64); + ret = gf_string2uint64 (optstr, &size64); if (ret == -1) { gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format" " option: nfs3.read-size"); @@ -5209,7 +5209,7 @@ nfs3_init_options (struct nfs3_state *nfs3, dict_t *options) goto err; } - ret = gf_string2bytesize (optstr, &size64); + ret = gf_string2uint64 (optstr, &size64); if (ret == -1) { gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format" " option: nfs3.write-size"); @@ -5232,7 +5232,7 @@ nfs3_init_options (struct nfs3_state *nfs3, dict_t *options) goto err; } - ret = gf_string2bytesize (optstr, &size64); + ret = gf_string2uint64 (optstr, &size64); if (ret == -1) { gf_log (GF_NFS3, GF_LOG_ERROR, "Failed to format" " option: nfs3.readdir-size"); diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index c186537ea..d0caa97c2 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -2423,9 +2423,21 @@ nlm4svc_init(xlator_t *nfsx) /* unlink sm-notify.pid so that when we restart rpc.statd/sm-notify * it thinks that the machine has restarted and sends NOTIFY to clients. */ - ret = unlink ("/var/run/sm-notify.pid"); + + /* TODO: + notify/rpc.statd is done differently on OSX + + On OSX rpc.statd is controlled by rpc.lockd and are part for launchd + (unified service management framework) + + A runcmd() should be invoking "launchctl start com.apple.lockd" + instead. This is still a theory but we need to thoroughly test it + out. Until then NLM support is non-existent on OSX. + */ + ret = unlink (GF_SM_NOTIFY_PIDFILE); if (ret == -1 && errno != ENOENT) { - gf_log (GF_NLM, GF_LOG_ERROR, "unable to unlink sm-notify"); + gf_log (GF_NLM, GF_LOG_ERROR, "unable to unlink %s: %d", + GF_SM_NOTIFY_PIDFILE, errno); goto err; } /* temporary work around to restart statd, not distro/OS independant. @@ -2433,37 +2445,43 @@ nlm4svc_init(xlator_t *nfsx) * killall will cause problems on solaris. */ - pidfile = fopen ("/var/run/rpc.statd.pid", "r"); + char *pid_file = GF_RPC_STATD_PIDFILE; + if (nfs->rpc_statd_pid_file) + pid_file = nfs->rpc_statd_pid_file; + pidfile = fopen (pid_file, "r"); if (pidfile) { ret = fscanf (pidfile, "%d", &pid); if (ret <= 0) { gf_log (GF_NLM, GF_LOG_WARNING, "unable to get pid of " - "rpc.statd"); + "rpc.statd from %s ", GF_RPC_STATD_PIDFILE); ret = runcmd ("killall", "-9", "rpc.statd", NULL); } else kill (pid, SIGKILL); fclose (pidfile); } else { - gf_log (GF_NLM, GF_LOG_WARNING, "opening the pid file of " - "rpc.statd failed (%s)", strerror (errno)); + gf_log (GF_NLM, GF_LOG_WARNING, "opening %s of " + "rpc.statd failed (%s)", pid_file, strerror (errno)); /* if ret == -1, do nothing - case either statd was not * running or was running in valgrind mode */ ret = runcmd ("killall", "-9", "rpc.statd", NULL); } - ret = unlink ("/var/run/rpc.statd.pid"); + ret = unlink (GF_RPC_STATD_PIDFILE); if (ret == -1 && errno != ENOENT) { - gf_log (GF_NLM, GF_LOG_ERROR, "unable to unlink rpc.statd"); + gf_log (GF_NLM, GF_LOG_ERROR, "unable to unlink %s", pid_file); goto err; } - ret = runcmd ("/sbin/rpc.statd", NULL); + ret = runcmd (nfs->rpc_statd, NULL); if (ret == -1) { - gf_log (GF_NLM, GF_LOG_ERROR, "unable to start rpc.statd"); + gf_log (GF_NLM, GF_LOG_ERROR, "unable to start %s", + nfs->rpc_statd); goto err; } + + pthread_create (&thr, NULL, nsm_thread, (void*)NULL); timeout.tv_sec = nlm_grace_period; diff --git a/xlators/nfs/server/src/nlm4.h b/xlators/nfs/server/src/nlm4.h index 9b5d54081..5b6296110 100644 --- a/xlators/nfs/server/src/nlm4.h +++ b/xlators/nfs/server/src/nlm4.h @@ -34,6 +34,15 @@ /* Registered with portmap */ #define GF_NLM4_PORT 38468 #define GF_NLM GF_NFS"-NLM" +#ifdef GF_DARWIN_HOST_OS +#define GF_RPC_STATD_PROG "/usr/sbin/rpc.statd" +#define GF_RPC_STATD_PIDFILE "/var/run/statd.pid" +#define GF_SM_NOTIFY_PIDFILE "/var/run/statd.notify.pid" +#else +#define GF_RPC_STATD_PROG "/sbin/rpc.stat" +#define GF_RPC_STATD_PIDFILE "/var/run/rpc.statd.pid" +#define GF_SM_NOTIFY_PIDFILE "/var/run/sm-notify.pid" +#endif extern rpcsvc_program_t * nlm4svc_init (xlator_t *nfsx); -- cgit From 9819fcedf10f1430d4969c86e6df4dfe975b7dcf Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Tue, 22 Apr 2014 13:27:35 -0700 Subject: rpcgen: Remove autogenerated files instead build on demand Avoid modifying autogenerated files and keeping them in repository - autogenerate them on demand from ".x" files Change-Id: I2cdb1fe9b99768ceb80a8cb100fa00bd1d8fe2c6 BUG: 1090807 Signed-off-by: Harshavardhana Reviewed-on: http://review.gluster.org/7526 Tested-by: Gluster Build System Reviewed-by: Niels de Vos Reviewed-by: Anand Avati --- xlators/nfs/server/src/acl3.h | 5 +++++ xlators/nfs/server/src/nlm4.c | 45 ++++++++++++++++++------------------- xlators/nfs/server/src/nlm4.h | 26 +++++++++++++++++++++ xlators/nfs/server/src/nlmcbk_svc.c | 1 - 4 files changed, 53 insertions(+), 24 deletions(-) (limited to 'xlators/nfs/server') diff --git a/xlators/nfs/server/src/acl3.h b/xlators/nfs/server/src/acl3.h index 03d626f3e..220bc9e78 100644 --- a/xlators/nfs/server/src/acl3.h +++ b/xlators/nfs/server/src/acl3.h @@ -13,6 +13,11 @@ #include "glusterfs-acl.h" +#define ACL3_NULL 0 +#define ACL3_GETACL 1 +#define ACL3_SETACL 2 +#define ACL3_PROC_COUNT 3 + #define GF_ACL3_PORT 38469 #define GF_ACL GF_NFS"-ACL" diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index d0caa97c2..042cfeba1 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -33,7 +33,6 @@ #include "nfs-generics.h" #include "rpc-clnt.h" #include "nsm-xdr.h" -#include "nlmcbk-xdr.h" #include "run.h" #include #include @@ -157,9 +156,9 @@ nlm4_prep_nlm4_testargs (nlm4_testargs *args, struct nfs3_fh *fh, nlm4_lkowner_t *oh, char *cookiebytes) { memset (args, 0, sizeof (*args)); - args->alock.fh.n_bytes = (void *)fh; - args->alock.oh.n_bytes = (void *)oh; - args->cookie.n_bytes = (void *)cookiebytes; + args->alock.fh.nlm4_netobj_val = (void *)fh; + args->alock.oh.nlm4_netobj_val = (void *)oh; + args->cookie.nlm4_netobj_val = (void *)cookiebytes; } void @@ -167,9 +166,9 @@ nlm4_prep_nlm4_lockargs (nlm4_lockargs *args, struct nfs3_fh *fh, nlm4_lkowner_t *oh, char *cookiebytes) { memset (args, 0, sizeof (*args)); - args->alock.fh.n_bytes = (void *)fh; - args->alock.oh.n_bytes = (void *)oh; - args->cookie.n_bytes = (void *)cookiebytes; + args->alock.fh.nlm4_netobj_val = (void *)fh; + args->alock.oh.nlm4_netobj_val = (void *)oh; + args->cookie.nlm4_netobj_val = (void *)cookiebytes; } void @@ -177,9 +176,9 @@ nlm4_prep_nlm4_cancargs (nlm4_cancargs *args, struct nfs3_fh *fh, nlm4_lkowner_t *oh, char *cookiebytes) { memset (args, 0, sizeof (*args)); - args->alock.fh.n_bytes = (void *)fh; - args->alock.oh.n_bytes = (void *)oh; - args->cookie.n_bytes = (void *)cookiebytes; + args->alock.fh.nlm4_netobj_val = (void *)fh; + args->alock.oh.nlm4_netobj_val = (void *)oh; + args->cookie.nlm4_netobj_val = (void *)cookiebytes; } void @@ -187,9 +186,9 @@ nlm4_prep_nlm4_unlockargs (nlm4_unlockargs *args, struct nfs3_fh *fh, nlm4_lkowner_t *oh, char *cookiebytes) { memset (args, 0, sizeof (*args)); - args->alock.fh.n_bytes = (void *)fh; - args->alock.oh.n_bytes = (void *)oh; - args->cookie.n_bytes = (void *)cookiebytes; + args->alock.fh.nlm4_netobj_val = (void *)fh; + args->alock.oh.nlm4_netobj_val = (void *)oh; + args->cookie.nlm4_netobj_val = (void *)cookiebytes; } void @@ -197,9 +196,9 @@ nlm4_prep_shareargs (nlm4_shareargs *args, struct nfs3_fh *fh, nlm4_lkowner_t *oh, char *cookiebytes) { memset (args, 0, sizeof (*args)); - args->share.fh.n_bytes = (void *)fh; - args->share.oh.n_bytes = (void *)oh; - args->cookie.n_bytes = (void *)cookiebytes; + args->share.fh.nlm4_netobj_val = (void *)fh; + args->share.oh.nlm4_netobj_val = (void *)oh; + args->cookie.nlm4_netobj_val = (void *)cookiebytes; } void @@ -210,22 +209,22 @@ nlm4_prep_freeallargs (nlm4_freeallargs *args, nlm4_lkowner_t *oh) } void -nlm_copy_lkowner (gf_lkowner_t *dst, netobj *src) +nlm_copy_lkowner (gf_lkowner_t *dst, nlm4_netobj *src) { - dst->len = src->n_len; - memcpy (dst->data, src->n_bytes, dst->len); + dst->len = src->nlm4_netobj_len; + memcpy (dst->data, src->nlm4_netobj_val, dst->len); } int -nlm_is_oh_same_lkowner (gf_lkowner_t *a, netobj *b) +nlm_is_oh_same_lkowner (gf_lkowner_t *a, nlm4_netobj *b) { if (!a || !b) { gf_log (GF_NLM, GF_LOG_ERROR, "invalid args"); return -1; } - return (a->len == b->n_len && - !memcmp (a->data, b->n_bytes, a->len)); + return (a->len == b->nlm4_netobj_len && + !memcmp (a->data, b->nlm4_netobj_val, a->len)); } nlm4_stats @@ -653,7 +652,7 @@ err: } int -nlm4_generic_reply (rpcsvc_request_t *req, netobj cookie, nlm4_stats stat) +nlm4_generic_reply (rpcsvc_request_t *req, nlm4_netobj cookie, nlm4_stats stat) { nlm4_res res; diff --git a/xlators/nfs/server/src/nlm4.h b/xlators/nfs/server/src/nlm4.h index 5b6296110..e234b6944 100644 --- a/xlators/nfs/server/src/nlm4.h +++ b/xlators/nfs/server/src/nlm4.h @@ -31,6 +31,32 @@ #include "nlm4-xdr.h" #include "lkowner.h" +#define NLM4_NULL 0 +#define NLM4_TEST 1 +#define NLM4_LOCK 2 +#define NLM4_CANCEL 3 +#define NLM4_UNLOCK 4 +#define NLM4_GRANTED 5 +#define NLM4_TEST_MSG 6 +#define NLM4_LOCK_MSG 7 +#define NLM4_CANCEL_MSG 8 +#define NLM4_UNLOCK_MSG 9 +#define NLM4_GRANTED_MSG 10 +#define NLM4_TEST_RES 11 +#define NLM4_LOCK_RES 12 +#define NLM4_CANCEL_RES 13 +#define NLM4_UNLOCK_RES 14 +#define NLM4_GRANTED_RES 15 +#define NLM4_SM_NOTIFY 16 +#define NLM4_SEVENTEEN 17 +#define NLM4_EIGHTEEN 18 +#define NLM4_NINETEEN 19 +#define NLM4_SHARE 20 +#define NLM4_UNSHARE 21 +#define NLM4_NM_LOCK 22 +#define NLM4_FREE_ALL 23 +#define NLM4_PROC_COUNT 24 + /* Registered with portmap */ #define GF_NLM4_PORT 38468 #define GF_NLM GF_NFS"-NLM" diff --git a/xlators/nfs/server/src/nlmcbk_svc.c b/xlators/nfs/server/src/nlmcbk_svc.c index e1b588765..20d3728d0 100644 --- a/xlators/nfs/server/src/nlmcbk_svc.c +++ b/xlators/nfs/server/src/nlmcbk_svc.c @@ -13,7 +13,6 @@ * It was generated using rpcgen. */ -#include "nlmcbk-xdr.h" #include "nlm4.h" #include "logging.h" #include -- cgit From 3b40a553f466aa3d671efc2ae892215bebaa4c7b Mon Sep 17 00:00:00 2001 From: Santosh Kumar Pradhan Date: Thu, 24 Apr 2014 12:55:05 +0530 Subject: gNFS: Log properly for pmap_getport() fail in NLM In NLM callback path, if pmap_getport() FAILs, it just log the error message saying "Is firewall running on the client". It may happen that RPC services are not running e.g. "rpcbind" is not running or nlockmgr (NLM) is not registered with portmapper which all can be checked using "rpcinfo -p" command. FIX: Modify the log message to include the later case mentioned above. Change-Id: If422275b2ab59d1e974a6caa37132f31e9a34329 BUG: 1090782 Signed-off-by: Santosh Kumar Pradhan Reviewed-on: http://review.gluster.org/7544 Reviewed-by: Niels de Vos Tested-by: Gluster Build System Reviewed-by: Rajesh Joseph --- xlators/nfs/server/src/nlm4.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'xlators/nfs/server') diff --git a/xlators/nfs/server/src/nlm4.c b/xlators/nfs/server/src/nlm4.c index 042cfeba1..4d0083fe2 100644 --- a/xlators/nfs/server/src/nlm4.c +++ b/xlators/nfs/server/src/nlm4.c @@ -974,8 +974,10 @@ nlm4_establish_callback (void *csarg) NLM_V4, IPPROTO_TCP); if (port == 0) { - gf_log (GF_NLM, GF_LOG_ERROR, "Unable to get NLM port of the " - "client. Is the firewall running on client?"); + gf_log (GF_NLM, GF_LOG_ERROR, + "Unable to get NLM port of the client." + " Is the firewall running on client?" + " OR Are RPC services running (rpcinfo -p)?"); goto err; } -- cgit