linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Murphy Zhou <jencce.kernel@gmail.com>
To: miklos@szeredi.hu, viro@zeniv.linux.org.uk,
	linux-fsdevel@vger.kernel.org
Subject: [PATCH] fs/open.c: update {m,c}time for truncate
Date: Thu, 22 Aug 2019 15:33:00 +0800	[thread overview]
Message-ID: <20190822073300.6ljb36ieah5g2p55@XZHOUW.usersys.redhat.com> (raw)

Just like what we do for ftruncate. (Why not)
Without this patch, cifs, sometimes NFS, fail to update timestamps
after truncate call.

Signed-off-by: Murphy Zhou <jencce.kernel@gmail.com>
---
 fs/open.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/open.c b/fs/open.c
index a59abe3c669a..f247085aaee4 100644
--- a/fs/open.c
+++ b/fs/open.c
@@ -107,7 +107,8 @@ long vfs_truncate(const struct path *path, loff_t length)
 	if (!error)
 		error = security_path_truncate(path);
 	if (!error)
-		error = do_truncate(path->dentry, length, 0, NULL);
+		error = do_truncate(path->dentry, length,
+				ATTR_MTIME|ATTR_CTIME, NULL);
 
 put_write_and_out:
 	put_write_access(inode);
-- 
2.21.0


             reply	other threads:[~2019-08-22  7:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-22  7:33 Murphy Zhou [this message]
2019-08-22 12:08 ` [PATCH] fs/open.c: update {m,c}time for truncate Miklos Szeredi
2019-08-22 13:03   ` Miklos Szeredi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190822073300.6ljb36ieah5g2p55@XZHOUW.usersys.redhat.com \
    --to=jencce.kernel@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=miklos@szeredi.hu \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).