]> git.hungrycats.org Git - linux/commitdiff
[PATCH] kNFSd: Honour SUN NFSv2 hack for "set times to server time.
authorAndrew Morton <akpm@osdl.org>
Mon, 19 Jan 2004 02:57:09 +0000 (18:57 -0800)
committerLinus Torvalds <torvalds@home.osdl.org>
Mon, 19 Jan 2004 02:57:09 +0000 (18:57 -0800)
From: NeilBrown <neilb@cse.unsw.edu.au>

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

see comment in code.

fs/nfsd/nfsxdr.c

index 1f7d8ecfe3e5797a47a94cd986974446f8cbf9c7..6c87eac22769e57df770e21ea36f3483e33eec38 100644 (file)
@@ -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;
 }