Linux NFS development
 help / color / mirror / Atom feed
* [PATCH] nfsd: update mtime on truncate
@ 2014-09-07 19:15 Christoph Hellwig
  2014-09-08 15:00 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: Christoph Hellwig @ 2014-09-07 19:15 UTC (permalink / raw)
  To: linux-nfs

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>
---
 fs/nfsd/vfs.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index f501a9b..60ed117 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;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] nfsd: update mtime on truncate
  2014-09-07 19:15 [PATCH] nfsd: update mtime on truncate Christoph Hellwig
@ 2014-09-08 15:00 ` J. Bruce Fields
  0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2014-09-08 15:00 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-nfs

On Sun, Sep 07, 2014 at 12:15:52PM -0700, Christoph Hellwig wrote:
> 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.

Thanks,  Intending just to queue up for 3.18 unless you see a reason
it's more urgent.

--b.

> 
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  fs/nfsd/vfs.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
> index f501a9b..60ed117 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;
> -- 
> 1.9.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-08 15:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-07 19:15 [PATCH] nfsd: update mtime on truncate Christoph Hellwig
2014-09-08 15:00 ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox