OSDN Git Service

CIFS: Fix splice read for non-cached files
authorPavel Shilovsky <pshilov@microsoft.com>
Thu, 19 Jan 2017 21:53:15 +0000 (13:53 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 12 Mar 2017 05:41:43 +0000 (06:41 +0100)
commitc06d74df4ebb9ab3fedcf6d623816944edd206f5
tree68c996faed5e5aead0f89cb20d912cd2400548d9
parent24427cd71d2fbef3eeb087e802ff327c18c7275f
CIFS: Fix splice read for non-cached files

commit 9c25702cee1405099f982894c865c163de7909a8 upstream.

Currently we call copy_page_to_iter() for uncached reading into a pipe.
This is wrong because it treats pages as VFS cache pages and copies references
rather than actual data. When we are trying to read from the pipe we end up
calling page_cache_pipe_buf_confirm() which returns -ENODATA. This error
is translated into 0 which is returned to a user.

This issue is reproduced by running xfs-tests suite (generic test #249)
against mount points with "cache=none". Fix it by mapping pages manually
and calling copy_to_iter() that copies data into the pipe.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/file.c