linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Frank Sorenson <sorenson@redhat.com>
To: linux-fsdevel@vger.kernel.org
Cc: hirofumi@mail.parknet.co.jp
Subject: [PATCH V5 4/4] fat: truncate inode timestamp updates in setattr
Date: Sun, 30 Sep 2018 22:33:53 -0500	[thread overview]
Message-ID: <a2b4701b1125573fafaeaae6802050ca86d6f8cc.1538363961.git.sorenson@redhat.com> (raw)
In-Reply-To: <cover.1538363961.git.sorenson@redhat.com>
In-Reply-To: <cover.1538363961.git.sorenson@redhat.com>

setattr_copy can't truncate timestamps correctly for
msdos/vfat, so truncate and copy them ourselves.

Signed-off-by: Frank Sorenson <sorenson@redhat.com>
---
 fs/fat/file.c | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fs/fat/file.c b/fs/fat/file.c
index 4b5438405415..13935ee99e1e 100644
--- a/fs/fat/file.c
+++ b/fs/fat/file.c
@@ -542,6 +542,18 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
 		up_write(&MSDOS_I(inode)->truncate_lock);
 	}
 
+	/*
+	 * setattr_copy can't truncate these appropriately, so we'll
+	 * copy them ourselves
+	 */
+	if (attr->ia_valid & ATTR_ATIME)
+		fat_truncate_time(inode, &attr->ia_atime, S_ATIME);
+	if (attr->ia_valid & ATTR_CTIME)
+		fat_truncate_time(inode, &attr->ia_ctime, S_CTIME);
+	if (attr->ia_valid & ATTR_MTIME)
+		fat_truncate_time(inode, &attr->ia_mtime, S_MTIME);
+	attr->ia_valid &= ~(ATTR_ATIME|ATTR_CTIME|ATTR_MTIME);
+
 	setattr_copy(inode, attr);
 	mark_inode_dirty(inode);
 out:
-- 
2.13.6

  parent reply	other threads:[~2018-10-01 10:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-01  3:33 [PATCH V5 0/4] fat: timestamp updates Frank Sorenson
2018-10-01  3:33 ` [PATCH V5 1/4] fat: create a function to calculate the timezone offest Frank Sorenson
2018-10-01  3:33 ` [PATCH V5 2/4] fat: add functions to update and truncate timestamps appropriately Frank Sorenson
2018-10-01  3:33 ` [PATCH V5 3/4] fat: change timestamp updates to use fat_truncate_time Frank Sorenson
2018-10-01  3:33 ` Frank Sorenson [this message]
2018-10-01  8:14 ` [PATCH V5 0/4] fat: timestamp updates OGAWA Hirofumi

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=a2b4701b1125573fafaeaae6802050ca86d6f8cc.1538363961.git.sorenson@redhat.com \
    --to=sorenson@redhat.com \
    --cc=hirofumi@mail.parknet.co.jp \
    --cc=linux-fsdevel@vger.kernel.org \
    --subject='Re: [PATCH V5 4/4] fat: truncate inode timestamp updates in setattr' \
    /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

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).