]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
fuse: atomic_o_trunc should truncate pagecache
authorMiklos Szeredi <mszeredi@redhat.com>
Thu, 8 Feb 2018 14:17:38 +0000 (15:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 3 Jul 2018 09:18:45 +0000 (11:18 +0200)
commit7863da30c256f3691963e8d41f760faaf2cb83aa
tree4ebd3f384c501dcc54b28a075fda88bc6e77ced5
parente6365d1bec6aea89688818d2a3bd1f77e4f725b3
fuse: atomic_o_trunc should truncate pagecache

commit df0e91d488276086bc07da2e389986cae0048c37 upstream.

Fuse has an "atomic_o_trunc" mode, where userspace filesystem uses the
O_TRUNC flag in the OPEN request to truncate the file atomically with the
open.

In this mode there's no need to send a SETATTR request to userspace after
the open, so fuse_do_setattr() checks this mode and returns.  But this
misses the important step of truncating the pagecache.

Add the missing parts of truncation to the ATTR_OPEN branch.

Reported-by: Chad Austin <chadaustin@fb.com>
Fixes: 6ff958edbf39 ("fuse: add atomic open+truncate support")
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Cc: <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/fuse/dir.c