diff options
author | Frank Sorenson <sorenson@redhat.com> | 2018-10-30 15:07:01 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-10-31 08:54:14 -0700 |
commit | 22ea4eba63410515c1aa6e0dde67bda22d31a660 (patch) | |
tree | 8a48fb2438b3fb4ef8051fe14a48c8e5d0422a9d /fs/fat/file.c | |
parent | cd83f6b194e95fa616dd3157ae7a63d4713b6670 (diff) |
fat: truncate inode timestamp updates in setattr
setattr_copy can't truncate timestamps correctly for
msdos/vfat, so truncate and copy them ourselves.
Link: http://lkml.kernel.org/r/a2b4701b1125573fafaeaae6802050ca86d6f8cc.1538363961.git.sorenson@redhat.com
Signed-off-by: Frank Sorenson <sorenson@redhat.com>
Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/fat/file.c')
-rw-r--r-- | fs/fat/file.c | 12 |
1 files changed, 12 insertions, 0 deletions
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: |