Skip to content

Commit faebf4e

Browse files
Trond MyklebustTrond Myklebust
authored andcommitted
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: Trond Myklebust <Trond.Myklebust@netapp.com>
1 parent c79ba78 commit faebf4e

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎fs/nfs/getroot.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,17 +135,15 @@ int nfs4_path_walk(struct nfs_server *server,
135135
struct nfs_fh lastfh;
136136
struct qstr name;
137137
int ret;
138-
//int referral_count = 0;
139138

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

142141
fsinfo.fattr = &fattr;
143142
nfs_fattr_init(&fattr);
144143

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

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

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

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

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

0 commit comments

Comments
 (0)