]> git.hungrycats.org Git - linux/commitdiff
[PATCH] kNFSd: New routine exp_pseudoroot() to find 'root' filehandle for nfsv4
authorNeil Brown <neilb@cse.unsw.edu.au>
Fri, 11 Oct 2002 12:34:28 +0000 (05:34 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Fri, 11 Oct 2002 12:34:28 +0000 (05:34 -0700)
NFSv4 has a concept of a 'root' filehandle (from which all other can
be found via LOOKUP, so no need for mountd).

This patch defines exp_pseudoroot(), which is used to set the filehandle
for the root of the pseudofs. The root is defined to be the export
point with fsid == 0.

fs/nfsd/export.c
include/linux/nfsd/export.h

index 8b451ba42aa6a033005d0b4054ba6a52d61edd2e..9474463e981b9dde725b12e7f800ca7f649b68a2 100644 (file)
@@ -550,6 +550,23 @@ out:
        return err;
 }
 
+/*
+ * Called when we need the filehandle for the root of the pseudofs,
+ * for a given NFSv4 client.   The root is defined to be the
+ * export point with fsid==0
+ */
+int
+exp_pseudoroot(struct svc_client *clp, struct svc_fh *fhp)
+{
+       struct svc_export *exp;
+
+       exp = exp_get_fsid(clp, 0);
+       if (!exp)
+               return nfserr_perm;
+
+       dget(exp->ex_dentry);
+       return fh_compose(fhp, exp, exp->ex_dentry, NULL);
+}
 
 /*
  * Find a valid client given an inet address. We always move the most
index 8c79deb497eea284f3371f4f8f042b269e7af9fb..9c50603cd671310d11e3b6abe8e7ee84d17b0745 100644 (file)
@@ -100,6 +100,7 @@ struct svc_export * exp_parent(struct svc_client *clp, struct vfsmount *mnt,
                                   struct dentry *dentry);
 int                    exp_rootfh(struct svc_client *, 
                                        char *path, struct knfsd_fh *, int maxsize);
+int                    exp_pseudoroot(struct svc_client *, struct svc_fh *fhp);
 int                    nfserrno(int errno);
 
 static inline struct svc_export *