fuse: update mtime on truncate(2)
authorMaxim Patlasov <MPatlasov@parallels.com>
Mon, 28 Apr 2014 12:19:22 +0000 (14:19 +0200)
committerMiklos Szeredi <mszeredi@suse.cz>
Mon, 28 Apr 2014 12:19:22 +0000 (14:19 +0200)
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 <MPatlasov@parallels.com>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
fs/fuse/dir.c

index 5b4e035b364cc604d68e72411337ef061a766fea..5e361b1225263a59a87c38bca509a4507c917335 100644 (file)
@@ -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));