diff options
author | Christoph Hellwig <hch@lst.de> | 2014-09-07 21:15:52 +0200 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2014-09-11 17:12:16 +0200 |
commit | f0c63124a6165792f6e37e4b5983792d009e1ce8 (patch) | |
tree | a7f1bba20c1706707da46372d88c244221e225e3 /fs/nfsd | |
parent | NFSD: Put export if prepare_creds() fail (diff) | |
download | linux-f0c63124a6165792f6e37e4b5983792d009e1ce8.tar.xz linux-f0c63124a6165792f6e37e4b5983792d009e1ce8.zip |
nfsd: update mtime on truncate
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>
Diffstat (limited to 'fs/nfsd')
-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 89d1ae3bcff7..965cffd17a0c 100644 --- a/fs/nfsd/vfs.c +++ b/fs/nfsd/vfs.c @@ -445,6 +445,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; |