]> git.hungrycats.org Git - linux/commitdiff
[PATCH] kNFSd: Fix for lookup-parent at pseudo root
authorAndrew Morton <akpm@osdl.org>
Thu, 26 Feb 2004 14:47:53 +0000 (06:47 -0800)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Thu, 26 Feb 2004 14:47:53 +0000 (06:47 -0800)
From: NeilBrown <neilb@cse.unsw.edu.au>

tests if current_fh is the pseudo root for the client and returns
nfserr_noent if so.  need to call exp_pseudoroot because different clients
can have

fs/nfsd/nfs4proc.c

index 39ee88b7fda5625b23ed8384d0545eb347a393cf..078529195e854b40425f35fc21995bd1ec40fbcd 100644 (file)
@@ -349,14 +349,18 @@ nfsd4_link(struct svc_rqst *rqstp, struct svc_fh *current_fh,
 static inline int
 nfsd4_lookupp(struct svc_rqst *rqstp, struct svc_fh *current_fh)
 {
-       /*
-        * XXX: We currently violate the spec in one small respect
-        * here.  If LOOKUPP is done at the root of the pseudofs,
-        * the spec requires us to return NFSERR_NOENT.  Personally,
-        * I think that leaving the filehandle unchanged is more
-        * logical, but this is an academic question anyway, since
-        * no clients actually use LOOKUPP.
-        */
+       struct svc_fh tmp_fh;
+       int ret;
+
+       fh_init(&tmp_fh, NFS4_FHSIZE);
+       if((ret = exp_pseudoroot(rqstp->rq_client, &tmp_fh,
+                             &rqstp->rq_chandle)) != 0)
+               return ret;
+       if (tmp_fh.fh_dentry == current_fh->fh_dentry) {
+               fh_put(&tmp_fh);
+               return nfserr_noent;
+       }
+       fh_put(&tmp_fh);
        return nfsd_lookup(rqstp, current_fh, "..", 2, current_fh);
 }