diff options
author | Christoph Hellwig <hch@lst.de> | 2014-09-07 12:15:52 -0700 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2017-06-05 21:17:11 +0100 |
commit | 7cf01c94a5c33bf2a8bc13eb4fae691ec487f9dd (patch) | |
tree | e76f48fd6dbb2775cdb061c737282fc2f997a1df /fs | |
parent | 51d1922991d08e8ea5e54cb425032f544f6337bc (diff) | |
download | linux-stable-7cf01c94a5c33bf2a8bc13eb4fae691ec487f9dd.tar.gz linux-stable-7cf01c94a5c33bf2a8bc13eb4fae691ec487f9dd.tar.bz2 linux-stable-7cf01c94a5c33bf2a8bc13eb4fae691ec487f9dd.zip |
nfsd: update mtime on truncate
commit f0c63124a6165792f6e37e4b5983792d009e1ce8 upstream.
This fixes a failure in xfstests generic/313 because nfs doesn't update
mtime on a truncate. The protocol requires this to be done implicity
for a size changing setattr.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfsd/vfs.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c index 521f717b4a99..3137a98233ab 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -448,6 +448,16 @@ nfsd_setattr(struct svc_rqst *rqstp, struct svc_fh *fhp, struct iattr *iap, if (err) goto out; size_change = 1; + + /* + * RFC5661, Section 18.30.4: + * Changing the size of a file with SETATTR indirectly + * changes the time_modify and change attributes. + * + * (and similar for the older RFCs) + */ + if (iap->ia_size != i_size_read(inode)) + iap->ia_valid |= ATTR_MTIME; } iap->ia_valid |= ATTR_CTIME; |