SUNRPC: Fix TCP receive code on archs with flush_dcache_page()
After receiving data into the page cache, we need to call flush_dcache_page()
for the architectures that define it.
Fixes: 277e4ab7d5
("SUNRPC: Simplify TCP receive code by switching...")
Reported-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Cc: stable@vger.kernel.org # v4.20
Tested-by: Geert Uytterhoeven <geert@linux-m68k.org>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
This commit is contained in:
parent
6e17f58c48
commit
6a829eb861
|
@ -48,6 +48,7 @@
|
|||
#include <net/udp.h>
|
||||
#include <net/tcp.h>
|
||||
#include <linux/bvec.h>
|
||||
#include <linux/highmem.h>
|
||||
#include <linux/uio.h>
|
||||
|
||||
#include <trace/events/sunrpc.h>
|
||||
|
@ -376,6 +377,26 @@ xs_read_discard(struct socket *sock, struct msghdr *msg, int flags,
|
|||
return sock_recvmsg(sock, msg, flags);
|
||||
}
|
||||
|
||||
#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE
|
||||
static void
|
||||
xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek)
|
||||
{
|
||||
struct bvec_iter bi = {
|
||||
.bi_size = count,
|
||||
};
|
||||
struct bio_vec bv;
|
||||
|
||||
bvec_iter_advance(bvec, &bi, seek & PAGE_MASK);
|
||||
for_each_bvec(bv, bvec, bi, bi)
|
||||
flush_dcache_page(bv.bv_page);
|
||||
}
|
||||
#else
|
||||
static inline void
|
||||
xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
static ssize_t
|
||||
xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags,
|
||||
struct xdr_buf *buf, size_t count, size_t seek, size_t *read)
|
||||
|
@ -409,6 +430,7 @@ xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags,
|
|||
seek + buf->page_base);
|
||||
if (ret <= 0)
|
||||
goto sock_err;
|
||||
xs_flush_bvec(buf->bvec, ret, seek + buf->page_base);
|
||||
offset += ret - buf->page_base;
|
||||
if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC))
|
||||
goto out;
|
||||
|
|
Loading…
Reference in New Issue