Commit 8d56addd authored by Miklos Szeredi's avatar Miklos Szeredi

fuse: fix truncate after open

Commit e1181ee6 "vfs: pass struct file to do_truncate on O_TRUNC
opens" broke the behavior of open(O_TRUNC|O_RDONLY) in fuse.  Fuse
assumed that when called from open, a truncate() will be done, not an
ftruncate().

Fix by restoring the old behavior, based on the ATTR_OPEN flag.
Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
parent 5a18ec17
...@@ -1283,8 +1283,11 @@ static int fuse_do_setattr(struct dentry *entry, struct iattr *attr, ...@@ -1283,8 +1283,11 @@ static int fuse_do_setattr(struct dentry *entry, struct iattr *attr,
if (err) if (err)
return err; return err;
if ((attr->ia_valid & ATTR_OPEN) && fc->atomic_o_trunc) if (attr->ia_valid & ATTR_OPEN) {
return 0; if (fc->atomic_o_trunc)
return 0;
file = NULL;
}
if (attr->ia_valid & ATTR_SIZE) if (attr->ia_valid & ATTR_SIZE)
is_truncate = true; is_truncate = true;
......
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