diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2013-04-19 16:09:37 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-04-19 17:21:07 -0400 |
commit | 042ad0b398ea4e937e38324dd096bdf9d2c495f7 (patch) | |
tree | a08f9ffb86378ebf11609f6fbb2868caabd81c54 | |
parent | 549b19cc9f31e8fdda317625d564bac0052a3328 (diff) |
nfs: Send atime and mtime as a 64bit value
RFC 3530 says that the seconds value of a nfstime4 structure is a 64bit
value, but we are instead sending a 32-bit 0 and then a 32bit conversion
of the 64bit Linux value. This means that if we try to set atime to a
value before the epoch (touch -t 196001010101) the client will only send
part of the new value due to lost precision.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4xdr.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index fef71cbec501..c2cbf0d90a31 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -1058,8 +1058,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const | |||
1058 | if (iap->ia_valid & ATTR_ATIME_SET) { | 1058 | if (iap->ia_valid & ATTR_ATIME_SET) { |
1059 | bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET; | 1059 | bmval1 |= FATTR4_WORD1_TIME_ACCESS_SET; |
1060 | *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); | 1060 | *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); |
1061 | *p++ = cpu_to_be32(0); | 1061 | p = xdr_encode_hyper(p, (s64)iap->ia_atime.tv_sec); |
1062 | *p++ = cpu_to_be32(iap->ia_atime.tv_sec); | ||
1063 | *p++ = cpu_to_be32(iap->ia_atime.tv_nsec); | 1062 | *p++ = cpu_to_be32(iap->ia_atime.tv_nsec); |
1064 | } | 1063 | } |
1065 | else if (iap->ia_valid & ATTR_ATIME) { | 1064 | else if (iap->ia_valid & ATTR_ATIME) { |
@@ -1069,8 +1068,7 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, const | |||
1069 | if (iap->ia_valid & ATTR_MTIME_SET) { | 1068 | if (iap->ia_valid & ATTR_MTIME_SET) { |
1070 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; | 1069 | bmval1 |= FATTR4_WORD1_TIME_MODIFY_SET; |
1071 | *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); | 1070 | *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); |
1072 | *p++ = cpu_to_be32(0); | 1071 | p = xdr_encode_hyper(p, (s64)iap->ia_mtime.tv_sec); |
1073 | *p++ = cpu_to_be32(iap->ia_mtime.tv_sec); | ||
1074 | *p++ = cpu_to_be32(iap->ia_mtime.tv_nsec); | 1072 | *p++ = cpu_to_be32(iap->ia_mtime.tv_nsec); |
1075 | } | 1073 | } |
1076 | else if (iap->ia_valid & ATTR_MTIME) { | 1074 | else if (iap->ia_valid & ATTR_MTIME) { |