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



---

 25-akpm/fs/nfsd/nfs4xdr.c         |   11 +++++++++++
 25-akpm/include/linux/nfs4.h      |    1 +
 25-akpm/include/linux/nfsd/nfsd.h |    2 +-
 3 files changed, 13 insertions(+), 1 deletion(-)

diff -puN fs/nfsd/nfs4xdr.c~knfsd-05-mounted_on_fileid-support fs/nfsd/nfs4xdr.c
--- 25/fs/nfsd/nfs4xdr.c~knfsd-05-mounted_on_fileid-support	2004-04-03 02:59:51.307553008 -0800
+++ 25-akpm/fs/nfsd/nfs4xdr.c	2004-04-03 02:59:51.314551944 -0800
@@ -1588,7 +1588,18 @@ nfsd4_encode_fattr(struct svc_fh *fhp, s
 		WRITE32(stat.mtime.tv_sec);
 		WRITE32(stat.mtime.tv_nsec);
 	}
+	if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) {
+		struct dentry *mnt_pnt, *mnt_root;
 
+		if ((buflen -= 8) < 0)
+                	goto out_resource;
+		mnt_root = exp->ex_mnt->mnt_root;
+		if (mnt_root->d_inode == dentry->d_inode) {
+			mnt_pnt = exp->ex_mnt->mnt_mountpoint;
+			WRITE64((u64) mnt_pnt->d_inode->i_ino);
+		} else
+                	WRITE64((u64) stat.ino);
+	}
 	*attrlenp = htonl((char *)p - (char *)attrlenp - 4);
 	*countp = p - buffer;
 	status = nfs_ok;
diff -puN include/linux/nfs4.h~knfsd-05-mounted_on_fileid-support include/linux/nfs4.h
--- 25/include/linux/nfs4.h~knfsd-05-mounted_on_fileid-support	2004-04-03 02:59:51.308552856 -0800
+++ 25-akpm/include/linux/nfs4.h	2004-04-03 02:59:51.314551944 -0800
@@ -274,6 +274,7 @@ enum lock_type4 {
 #define FATTR4_WORD1_TIME_METADATA      (1 << 20)
 #define FATTR4_WORD1_TIME_MODIFY        (1 << 21)
 #define FATTR4_WORD1_TIME_MODIFY_SET    (1 << 22)
+#define FATTR4_WORD1_MOUNTED_ON_FILEID  (1 << 23)
 
 #define NFSPROC4_NULL 0
 #define NFSPROC4_COMPOUND 1
diff -puN include/linux/nfsd/nfsd.h~knfsd-05-mounted_on_fileid-support include/linux/nfsd/nfsd.h
--- 25/include/linux/nfsd/nfsd.h~knfsd-05-mounted_on_fileid-support	2004-04-03 02:59:51.310552552 -0800
+++ 25-akpm/include/linux/nfsd/nfsd.h	2004-04-03 02:59:51.315551792 -0800
@@ -278,7 +278,7 @@ static inline int is_fsid(struct svc_fh 
  | FATTR4_WORD1_SPACE_AVAIL     | FATTR4_WORD1_SPACE_FREE   | FATTR4_WORD1_SPACE_TOTAL      \
  | FATTR4_WORD1_SPACE_USED      | FATTR4_WORD1_TIME_ACCESS  | FATTR4_WORD1_TIME_ACCESS_SET  \
  | FATTR4_WORD1_TIME_CREATE     | FATTR4_WORD1_TIME_DELTA   | FATTR4_WORD1_TIME_METADATA    \
- | FATTR4_WORD1_TIME_MODIFY     | FATTR4_WORD1_TIME_MODIFY_SET)
+ | FATTR4_WORD1_TIME_MODIFY     | FATTR4_WORD1_TIME_MODIFY_SET | FATTR4_WORD1_MOUNTED_ON_FILEID)
 
 /* These will return ERR_INVAL if specified in GETATTR or READDIR. */
 #define NFSD_WRITEONLY_ATTRS_WORD1							    \

_
