aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/export.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2009-09-27 14:41:43 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2009-09-28 12:21:26 -0400
commitf39bde24b275ddc45df1ed835725b609e178c7a0 (patch)
tree17708324bb82f3fb4db2e9902dbcc9de03cbc1ff /fs/nfsd/export.c
parent289ede453e5a621de19c61e630302b1845cc1d59 (diff)
nfsd4: fix error return when pseudoroot missing
We really shouldn't hit this case at all, and forthcoming kernel and nfs-utils changes should eliminate this case; if it does happen, consider it a bug rather than reporting an error that doesn't really make sense for the operation (since there's no reason for a server to be accepting v4 traffic yet have no root filehandle). Also move some exp_pseudoroot code into a helper function while we're here. Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/nfsd/export.c')
-rw-r--r--fs/nfsd/export.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/fs/nfsd/export.c b/fs/nfsd/export.c
index c1c9e035d4a4..b73baba3fb97 100644
--- a/fs/nfsd/export.c
+++ b/fs/nfsd/export.c
@@ -1320,6 +1320,23 @@ rqst_exp_parent(struct svc_rqst *rqstp, struct path *path)
1320 return exp; 1320 return exp;
1321} 1321}
1322 1322
1323static struct svc_export *find_fsidzero_export(struct svc_rqst *rqstp)
1324{
1325 struct svc_export *exp;
1326 u32 fsidv[2];
1327
1328 mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL);
1329
1330 exp = rqst_exp_find(rqstp, FSID_NUM, fsidv);
1331 /*
1332 * We shouldn't have accepting an nfsv4 request at all if we
1333 * don't have a pseudoexport!:
1334 */
1335 if (IS_ERR(exp) && PTR_ERR(exp) == -ENOENT)
1336 exp = ERR_PTR(-ESERVERFAULT);
1337 return exp;
1338}
1339
1323/* 1340/*
1324 * Called when we need the filehandle for the root of the pseudofs, 1341 * Called when we need the filehandle for the root of the pseudofs,
1325 * for a given NFSv4 client. The root is defined to be the 1342 * for a given NFSv4 client. The root is defined to be the
@@ -1330,11 +1347,8 @@ exp_pseudoroot(struct svc_rqst *rqstp, struct svc_fh *fhp)
1330{ 1347{
1331 struct svc_export *exp; 1348 struct svc_export *exp;
1332 __be32 rv; 1349 __be32 rv;
1333 u32 fsidv[2];
1334
1335 mk_fsid(FSID_NUM, fsidv, 0, 0, 0, NULL);
1336 1350
1337 exp = rqst_exp_find(rqstp, FSID_NUM, fsidv); 1351 exp = find_fsidzero_export(rqstp);
1338 if (IS_ERR(exp)) 1352 if (IS_ERR(exp))
1339 return nfserrno(PTR_ERR(exp)); 1353 return nfserrno(PTR_ERR(exp));
1340 rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL); 1354 rv = fh_compose(fhp, exp, exp->ex_path.dentry, NULL);