Skip to contentSkip to conversation

kNFSd - 5 of 6 - Honour SUN NFSv2 hack for "set times to server time.

PATCH New NeilBrown 1 participant 1 message Jan 16, 2004

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 kNFSd - 5 of 6 - Honour SUN NFSv2 hack for "set times to server time.

Quoted 2 lines

From Greg Banks <[email protected]>,

see comment in code.

----------- Diffstat output ------------

 ./fs/nfsd/nfsxdr.c |   11 +++++++++++
 1 files changed, 11 insertions(+)
fs/nfsd/nfsxdr.c renamed from fs/nfsd/nfsxdr.c~current~ +11 -0
diff ./fs/nfsd/nfsxdr.c~current~ ./fs/nfsd/nfsxdr.c
@@ -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;
 }

-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs