]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
fuse: fix fuse_send_readpages() in the syncronous read case
authorMiklos Szeredi <mszeredi@redhat.com>
Thu, 16 Jan 2020 10:09:36 +0000 (11:09 +0100)
committerPaolo Pisati <paolo.pisati@canonical.com>
Thu, 30 Jan 2020 15:25:48 +0000 (16:25 +0100)
commit125d307baddffb25bed2963445545cd3ab1dd3d6
tree98125ecd0e8385d60739175a8fadca226f24f89b
parent2e2041da252fd16ba78357ba8d14b415b8fcc7cf
fuse: fix fuse_send_readpages() in the syncronous read case

BugLink: https://bugs.launchpad.net/bugs/1861090
commit 7df1e988c723a066754090b22d047c3225342152 upstream.

Buffered read in fuse normally goes via:

 -> generic_file_buffered_read()
   -> fuse_readpages()
     -> fuse_send_readpages()
       ->fuse_simple_request() [called since v5.4]

In the case of a read request, fuse_simple_request() will return a
non-negative bytecount on success or a negative error value.  A positive
bytecount was taken to be an error and the PG_error flag set on the page.
This resulted in generic_file_buffered_read() falling back to ->readpage(),
which would repeat the read request and succeed.  Because of the repeated
read succeeding the bug was not detected with regression tests or other use
cases.

The FTP module in GVFS however fails the second read due to the
non-seekable nature of FTP downloads.

Fix by checking and ignoring positive return value from
fuse_simple_request().

Reported-by: Ondrej Holy <oholy@redhat.com>
Link: https://gitlab.gnome.org/GNOME/gvfs/issues/441
Fixes: 134831e36bbd ("fuse: convert readpages to simple api")
Cc: <stable@vger.kernel.org> # v5.4
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/fuse/file.c