mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-06 19:07:52 +00:00
cifs: update ctime and mtime during truncate
[ Upstream commit 5618303d85
]
As the man description of the truncate, if the size changed,
then the st_ctime and st_mtime fields should be updated. But
in cifs, we doesn't do it.
It lead the xfstests generic/313 failed.
So, add the ATTR_MTIME|ATTR_CTIME flags on attrs when change
the file size
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
7038f9eb42
commit
34a71f641f
1 changed files with 9 additions and 0 deletions
|
@ -2216,6 +2216,15 @@ cifs_set_file_size(struct inode *inode, struct iattr *attrs,
|
||||||
if (rc == 0) {
|
if (rc == 0) {
|
||||||
cifsInode->server_eof = attrs->ia_size;
|
cifsInode->server_eof = attrs->ia_size;
|
||||||
cifs_setsize(inode, attrs->ia_size);
|
cifs_setsize(inode, attrs->ia_size);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The man page of truncate says if the size changed,
|
||||||
|
* then the st_ctime and st_mtime fields for the file
|
||||||
|
* are updated.
|
||||||
|
*/
|
||||||
|
attrs->ia_ctime = attrs->ia_mtime = current_time(inode);
|
||||||
|
attrs->ia_valid |= ATTR_CTIME | ATTR_MTIME;
|
||||||
|
|
||||||
cifs_truncate_page(inode->i_mapping, inode->i_size);
|
cifs_truncate_page(inode->i_mapping, inode->i_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue