Commit 22ea4eba authored by Frank Sorenson's avatar Frank Sorenson Committed by Linus Torvalds

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.comSigned-off-by: default avatarFrank Sorenson <sorenson@redhat.com>
Acked-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent cd83f6b1
...@@ -542,6 +542,18 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr) ...@@ -542,6 +542,18 @@ int fat_setattr(struct dentry *dentry, struct iattr *attr)
up_write(&MSDOS_I(inode)->truncate_lock); 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); setattr_copy(inode, attr);
mark_inode_dirty(inode); mark_inode_dirty(inode);
out: out:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment