summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2016-05-19 12:53:09 +0200
committerNiels de Vos <ndevos@redhat.com>2016-05-24 01:35:09 -0700
commit125c2f6d06dfeace7469adf3e5d7be98dd34d3c3 (patch)
tree38ce1e41dbd0ab09812d74d7e8e8c1925869709d /xlators
parent842ec2af2cb0a0fecc9da018a51814946b89231e (diff)
nfs: strip trailing / when clients do subdir mounts
Mounting a volume over NFS with a subdir followed by a / does not work: # mount -t nfs -o vers=3 storage.example.com:/media/installation/ /mnt mount.nfs: an incorrect mount option was specified In the nfs.log: [client-rpc-fops.c:2930:client3_3_lookup_cbk] 0-media-client-0: remote operation failed. Path: /installation/ (00000000-0000-0000-0000-000000000000) [Invalid argument] [client-rpc-fops.c:2930:client3_3_lookup_cbk] 0-media-client-1: remote operation failed. Path: /installation/ (00000000-0000-0000-0000-000000000000) [Invalid argument] [mount3.c:1134:mnt3_resolve_subdir_cbk] 0-nfs: path=/installation/ (Invalid argument) [Invalid argument] It is not possible to resolve paths with a trailing /. Stripping trailing /'s from the subdir to mount is sufficient to make it work again. Backport: > Change-Id: I4075d4cd351438de58e1ff81f0fb65a1ff076da4 > BUG: 1337597 > Reviewed-on: http://review.gluster.org/14421 > Signed-off-by: Niels de Vos <ndevos@redhat.com> Change-Id: I4075d4cd351438de58e1ff81f0fb65a1ff076da4 BUG: 1337596 Signed-off-by: Niels de Vos <ndevos@redhat.com> Reviewed-on: http://review.gluster.org/14424 NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: jiffin tony Thottan <jthottan@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/nfs/server/src/mount3.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/xlators/nfs/server/src/mount3.c b/xlators/nfs/server/src/mount3.c
index 7b49d097d96..cb8b9a1af2f 100644
--- a/xlators/nfs/server/src/mount3.c
+++ b/xlators/nfs/server/src/mount3.c
@@ -1524,6 +1524,7 @@ mnt3_resolve_subdir (rpcsvc_request_t *req, struct mount3_state *ms,
int ret = -EFAULT;
struct nfs3_fh pfh = GF_NFS3FH_STATIC_INITIALIZER;
struct sockaddr_in *sin = NULL;
+ int len = -1;
if ((!req) || (!ms) || (!exp) || (!subdir))
return ret;
@@ -1551,7 +1552,10 @@ mnt3_resolve_subdir (rpcsvc_request_t *req, struct mount3_state *ms,
mres->exp = exp;
mres->mstate = ms;
mres->req = req;
+
strncpy (mres->remainingdir, subdir, MNTPATHLEN);
+ gf_path_strip_trailing_slashes (mres->remainingdir);
+
if (gf_nfs_dvm_off (nfs_state (ms->nfsx)))
pfh = nfs3_fh_build_indexed_root_fh (
mres->mstate->nfsx->children,
@@ -2493,6 +2497,7 @@ mnt3svc_umnt (rpcsvc_request_t *req)
if (colon) {
*colon= '\0';
}
+ gf_path_strip_trailing_slashes (dirpath);
gf_msg_debug (GF_MNT, 0, "dirpath: %s, hostname: %s", dirpath,
hostname);
ret = mnt3svc_umount (ms, dirpath, hostname);