From: Maxim Patlasov Date: Mon, 28 Apr 2014 12:19:22 +0000 (+0200) Subject: fuse: update mtime on truncate(2) X-Git-Tag: MMI-PSA29.97-13-9~12246^2~11 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=009dd694e82098a703b8b5c8dd9f54c131dbb9b3;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git fuse: update mtime on truncate(2) Handling truncate(2), VFS doesn't set ATTR_MTIME bit in iattr structure; only ATTR_SIZE bit is set. In-kernel fuse must handle the case by setting mtime fields of struct fuse_setattr_in to "now" and set FATTR_MTIME bit even though ATTR_MTIME was not set. Signed-off-by: Maxim Patlasov Signed-off-by: Miklos Szeredi --- diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 5b4e035b364c..5e361b122526 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1678,6 +1678,8 @@ int fuse_do_setattr(struct inode *inode, struct iattr *attr, if (is_truncate) { fuse_set_nowrite(inode); set_bit(FUSE_I_SIZE_UNSTABLE, &fi->state); + if (trust_local_mtime && attr->ia_size != inode->i_size) + attr->ia_valid |= ATTR_MTIME; } memset(&inarg, 0, sizeof(inarg));