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

From: Greg Banks <gnb@melbourne.sgi.com>,

see comment in code.



---

 25-akpm/fs/nfsd/nfsxdr.c |   11 +++++++++++
 1 files changed, 11 insertions(+)

diff -puN fs/nfsd/nfsxdr.c~nfsd-05-SUN-NFSv2-hack fs/nfsd/nfsxdr.c
--- 25/fs/nfsd/nfsxdr.c~nfsd-05-SUN-NFSv2-hack	Thu Jan 15 17:43:53 2004
+++ 25-akpm/fs/nfsd/nfsxdr.c	Thu Jan 15 17:43:53 2004
@@ -130,6 +130,17 @@ decode_sattr(u32 *p, struct iattr *iap)
 		iap->ia_valid |= ATTR_MTIME | ATTR_MTIME_SET;
 		iap->ia_mtime.tv_sec = tmp;
 		iap->ia_mtime.tv_nsec = tmp1 * 1000; 
+		/*
+		 * Passing the invalid value useconds=1000000 for mtime
+		 * is a Sun convention for "set both mtime and atime to
+		 * current server time".  It's needed to make permissions
+		 * checks for the "touch" program across v2 mounts to
+		 * Solaris and Irix boxes work correctly. See description of
+		 * sattr in section 6.1 of "NFS Illustrated" by
+		 * Brent Callaghan, Addison-Wesley, ISBN 0-201-32750-5
+		 */
+		if (tmp1 == 1000000)
+			iap->ia_valid &= ~(ATTR_ATIME_SET|ATTR_MTIME_SET);
 	}
 	return p;
 }

_
