From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com ([209.132.183.28]:55218 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727764AbeJAKJg (ORCPT ); Mon, 1 Oct 2018 06:09:36 -0400 From: Frank Sorenson 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 Message-Id: In-Reply-To: References: In-Reply-To: References: Sender: linux-fsdevel-owner@vger.kernel.org List-ID: setattr_copy can't truncate timestamps correctly for msdos/vfat, so truncate and copy them ourselves. Signed-off-by: Frank Sorenson --- 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