2010-06-22 12:50:25

by Trond Myklebust

[permalink] [raw]
Subject: Re: atime couldn't be set on a Linux NFSv4 client machine

On Tue, 2010-06-22 at 20:18 +0900, 小倉一夫 wrote:
> Hi, all...
>
> I'm using a Linux NFSv4 client and I've recently noticed that the atime of
> an NFS file couldn't be set explicitly on my NFSv4 client machine.
>
> So I looked into the Linux kernel code to find the reason.
> Now I believe that the following code is a bug inherited from older NFSv4
> kernel releases.
>
> fs/nfs/nfs4xdr.c
>
> static void encode_attrs(struct xdr_stream *xdr, const struct iattr *iap,
> const struct nfs_server *server) {
> :
> if (iap->ia_valid & ATTR_ATIME_SET) {
> bmval |= FATTR_WORD1_TIME_ACCESS_SET;
> *p++ = cpu_to_be32(NFS4_SET_TO_CLIENT_TIME);
> *p++ = cpu_to_be32(0);
> *p++ = cpu_to_be32(iap->ia_mtime.tv_sec);
> *p++ = cpu_to_be32(iap->ia_mtime.tv_usec);
>
> Are they really ia_mtime?

Whoops! That's an embarassing typo. All the more so, since you are
correct in that this probably dates back to the very early 2.6.x kernel
series.

Thanks for noticing this!

Cheers
Trond