summaryrefslogtreecommitdiffstats
path: root/xlators/nfs/server/src/nfs-common.c
diff options
context:
space:
mode:
authorBipin Kunal <bkunal@redhat.com>2017-02-27 15:23:04 +0530
committerNiels de Vos <ndevos@redhat.com>2017-04-07 06:37:28 -0400
commit40e571339b3c19ab2a5b6a93bc46eadf2252d006 (patch)
tree13fab01e97eeb2024d510e93ca80e01a7126d145 /xlators/nfs/server/src/nfs-common.c
parente01025973c73e2bd0eda8cfed22b75617305d740 (diff)
nfs: make subdir mounting work for Solaris 10 clients
This fixes the segfault caused by solaris client in Gluster/NFS. Volname was not being parsed properly, Instead of volume name complete path was being used in nfs_mntpath_to_xlator(). Fixed it by striping volume name from complete path in nfs_mntpath_to_xlator(). Modified function name nfs3_funge_solaris_zerolen_fh() to nfs3_funge_webnfs_zerolen_fh() as zero-filled filehandle is specific to WebNFS. RFC : https://tools.ietf.org/html/rfc2055 Solaris uses WebNFS, the zero-filled FH is defined in the WebNFS spec. Logic was even added in fuction nfs3_funge_webnfs_zerolen_fh() to send subdir path in function glfs_resolve_at() instead of complete path for subdir mount. Change-Id: I19aae3547b8910e7ed4974ee5385424cab3e834a BUG: 1426667 Signed-off-by: Bipin Kunal <bkunal@redhat.com> Reviewed-on: https://review.gluster.org/16770 Reviewed-by: Niels de Vos <ndevos@redhat.com> Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/nfs/server/src/nfs-common.c')
-rw-r--r--xlators/nfs/server/src/nfs-common.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/xlators/nfs/server/src/nfs-common.c b/xlators/nfs/server/src/nfs-common.c
index af37f6b264c..526918872d7 100644
--- a/xlators/nfs/server/src/nfs-common.c
+++ b/xlators/nfs/server/src/nfs-common.c
@@ -73,10 +73,11 @@ nfs_xlator_to_xlid (xlator_list_t *cl, xlator_t *xl)
xlator_t *
nfs_mntpath_to_xlator (xlator_list_t *cl, char *path)
{
- char *volname = NULL;
- char *volptr = NULL;
- size_t pathlen;
+ char *volname = NULL;
+ char *volptr = NULL;
+ size_t pathlen = -1;
xlator_t *targetxl = NULL;
+ int i = 0;
if ((!cl) || (!path))
return NULL;
@@ -89,10 +90,17 @@ nfs_mntpath_to_xlator (xlator_list_t *cl, char *path)
else
volptr = &volname[0];
- if (pathlen && volname[pathlen - 1] == '/')
- volname[pathlen - 1] = '\0';
+ for (i = 0; i < pathlen; i++) {
+ if (volname[i] == '/') {
+ volname[i] = '\0';
+ break;
+ }
+ }
while (cl) {
+ gf_msg_trace (GF_NFS, 0, "Volptr: %s and cl->xlator->name: %s",
+ volptr, cl->xlator->name);
+
if (strcmp (volptr, cl->xlator->name) == 0) {
targetxl = cl->xlator;
break;