]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Mon, 14 Jan 2019 09:28:55 +0000 (09:28 +0000)
commit840c77082f93f9760b7d1f096abbd61586632790
tree6500bab473b3e99e20c4afe6732d16789dd27768
parentc0e31b21449898319e1aea29d5c83c18214f8d67
fuse: atomic_o_trunc should truncate pagecache

BugLink: http://bugs.launchpad.net/bugs/1807469
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/fuse/dir.c