From: NeilBrown <neilb@cse.unsw.edu.au>

fh_dup2 duplicates an entire svc_fh structure, so in addition to dget()'ing
the dentry, it also needs to bump the reference count on fh_export.

Moved it out of the header file into nfsfh.c for the simple reason that I
couldn't figure out how to reorganize the headers files right so that the
fh_dup2 could use the definition of svc_fh.  Since fh_dup2 is never actually
used outside of nfs4proc.c, it could just as well be moved there....


---

 25-akpm/fs/nfsd/nfs4proc.c         |   10 ++++++++++
 25-akpm/include/linux/nfsd/nfsfh.h |    8 --------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff -puN fs/nfsd/nfs4proc.c~knfsd-fh_dup2-fix fs/nfsd/nfs4proc.c
--- 25/fs/nfsd/nfs4proc.c~knfsd-fh_dup2-fix	Mon Feb 23 16:33:51 2004
+++ 25-akpm/fs/nfsd/nfs4proc.c	Mon Feb 23 16:33:51 2004
@@ -55,6 +55,16 @@
 
 #define NFSDDBG_FACILITY		NFSDDBG_PROC
 
+static inline void
+fh_dup2(struct svc_fh *dst, struct svc_fh *src)
+{
+	fh_put(dst);
+	dget(src->fh_dentry);
+	if (src->fh_export)
+		cache_get(&src->fh_export->h);
+	*dst = *src;
+}
+
 static int
 do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_open *open)
 {
diff -puN include/linux/nfsd/nfsfh.h~knfsd-fh_dup2-fix include/linux/nfsd/nfsfh.h
--- 25/include/linux/nfsd/nfsfh.h~knfsd-fh_dup2-fix	Mon Feb 23 16:33:51 2004
+++ 25-akpm/include/linux/nfsd/nfsfh.h	Mon Feb 23 16:33:51 2004
@@ -209,14 +209,6 @@ fh_copy(struct svc_fh *dst, struct svc_f
 	return dst;
 }
 
-static __inline__ void
-fh_dup2(struct svc_fh *dst, struct svc_fh *src)
-{
-	fh_put(dst);
-	dget(src->fh_dentry);
-	*dst = *src;
-}
-
 static __inline__ struct svc_fh *
 fh_init(struct svc_fh *fhp, int maxsize)
 {

_