Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit faebf4e2 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4: Don't require that NFSv4 mount paths begin with '/'

Addresses the regression noted in
  http://bugzilla.linux-nfs.org/show_bug.cgi?id=134



Also mark a couple of other regressions as requiring fixing.

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent c79ba787
Loading
Loading
Loading
Loading
+6 −5
Original line number Original line Diff line number Diff line
@@ -135,17 +135,15 @@ int nfs4_path_walk(struct nfs_server *server,
	struct nfs_fh lastfh;
	struct nfs_fh lastfh;
	struct qstr name;
	struct qstr name;
	int ret;
	int ret;
	//int referral_count = 0;


	dprintk("--> nfs4_path_walk(,,%s)\n", path);
	dprintk("--> nfs4_path_walk(,,%s)\n", path);


	fsinfo.fattr = &fattr;
	fsinfo.fattr = &fattr;
	nfs_fattr_init(&fattr);
	nfs_fattr_init(&fattr);


	if (*path++ != '/') {
	/* Eat leading slashes */
		dprintk("nfs4_get_root: Path does not begin with a slash\n");
	while (*path == '/')
		return -EINVAL;
		path++;
	}


	/* Start by getting the root filehandle from the server */
	/* Start by getting the root filehandle from the server */
	ret = server->nfs_client->rpc_ops->getroot(server, mntfh, &fsinfo);
	ret = server->nfs_client->rpc_ops->getroot(server, mntfh, &fsinfo);
@@ -160,6 +158,7 @@ int nfs4_path_walk(struct nfs_server *server,
		return -ENOTDIR;
		return -ENOTDIR;
	}
	}


	/* FIXME: It is quite valid for the server to return a referral here */
	if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) {
	if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) {
		printk(KERN_ERR "nfs4_get_root:"
		printk(KERN_ERR "nfs4_get_root:"
		       " getroot obtained referral\n");
		       " getroot obtained referral\n");
@@ -187,6 +186,7 @@ int nfs4_path_walk(struct nfs_server *server,
		goto eat_dot_dir;
		goto eat_dot_dir;
	}
	}


	/* FIXME: Why shouldn't the user be able to use ".." in the path? */
	if (path[0] == '.' && path[1] == '.' && (path[2] == '/' || !path[2])
	if (path[0] == '.' && path[1] == '.' && (path[2] == '/' || !path[2])
	    ) {
	    ) {
		printk(KERN_ERR "nfs4_get_root:"
		printk(KERN_ERR "nfs4_get_root:"
@@ -212,6 +212,7 @@ int nfs4_path_walk(struct nfs_server *server,
		return -ENOTDIR;
		return -ENOTDIR;
	}
	}


	/* FIXME: Referrals are quite valid here too */
	if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) {
	if (fattr.valid & NFS_ATTR_FATTR_V4_REFERRAL) {
		printk(KERN_ERR "nfs4_get_root:"
		printk(KERN_ERR "nfs4_get_root:"
		       " lookupfh obtained referral\n");
		       " lookupfh obtained referral\n");