Commit e7d4b05c authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: Encode 64-bit timestamps

NFSv4 supports 64-bit timestamps, so there is no point in converting
the struct iattr timestamps to 32-bits before encoding.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent e86d5a02
...@@ -1059,7 +1059,7 @@ static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *ve ...@@ -1059,7 +1059,7 @@ static void encode_nfs4_verifier(struct xdr_stream *xdr, const nfs4_verifier *ve
} }
static __be32 * static __be32 *
xdr_encode_nfstime4(__be32 *p, const struct timespec *t) xdr_encode_nfstime4(__be32 *p, const struct timespec64 *t)
{ {
p = xdr_encode_hyper(p, (__s64)t->tv_sec); p = xdr_encode_hyper(p, (__s64)t->tv_sec);
*p++ = cpu_to_be32(t->tv_nsec); *p++ = cpu_to_be32(t->tv_nsec);
...@@ -1072,7 +1072,6 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, ...@@ -1072,7 +1072,6 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
const struct nfs_server *server, const struct nfs_server *server,
const uint32_t attrmask[]) const uint32_t attrmask[])
{ {
struct timespec ts;
char owner_name[IDMAP_NAMESZ]; char owner_name[IDMAP_NAMESZ];
char owner_group[IDMAP_NAMESZ]; char owner_group[IDMAP_NAMESZ];
int owner_namelen = 0; int owner_namelen = 0;
...@@ -1161,16 +1160,14 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap, ...@@ -1161,16 +1160,14 @@ static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
if (bmval[1] & FATTR4_WORD1_TIME_ACCESS_SET) { if (bmval[1] & FATTR4_WORD1_TIME_ACCESS_SET) {
if (iap->ia_valid & ATTR_ATIME_SET) { if (iap->ia_valid & ATTR_ATIME_SET) {
*p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME);
ts = timespec64_to_timespec(iap->ia_atime); p = xdr_encode_nfstime4(p, &iap->ia_atime);
p = xdr_encode_nfstime4(p, &ts);
} else } else
*p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME); *p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME);
} }
if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) { if (bmval[1] & FATTR4_WORD1_TIME_MODIFY_SET) {
if (iap->ia_valid & ATTR_MTIME_SET) { if (iap->ia_valid & ATTR_MTIME_SET) {
*p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME); *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME);
ts = timespec64_to_timespec(iap->ia_mtime); p = xdr_encode_nfstime4(p, &iap->ia_mtime);
p = xdr_encode_nfstime4(p, &ts);
} else } else
*p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME); *p++ = cpu_to_be32(NFS4_SET_TO_SERVER_TIME);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment