Message ID | CAJfpegvdWCC_jy_sjCZJm-x6PU7fA7L6wPezdZG7WTg2FijLWA@mail.gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On Thu, Feb 8, 2018 at 6:17 AM, Miklos Szeredi <miklos@szeredi.hu> wrote: > Thanks for the report and the patch. > > Here's a simpler patch (we don't actually need the > invalidate_inode_pages2(), because all the pages have already been > truncated). > > I tested it with your reproducer and it fixes the issue for me. > > Unless you see a problem with it, I'll queue this up for 4.16. Thanks! I verified that your simpler patch also fixes our more complex internal reproduction. Looking forward to it landing!
--- fs/fuse/dir.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1629,8 +1629,12 @@ int fuse_do_setattr(struct dentry *dentr return err; if (attr->ia_valid & ATTR_OPEN) { - if (fc->atomic_o_trunc) + if (fc->atomic_o_trunc) { + WARN_ON(!(attr->ia_valid & ATTR_SIZE)); + WARN_ON(attr->ia_size != 0); + truncate_pagecache(inode, 0); return 0; + } file = NULL; }