|
48 | 48 | #include <net/udp.h>
|
49 | 49 | #include <net/tcp.h>
|
50 | 50 | #include <linux/bvec.h>
|
| 51 | +#include <linux/highmem.h> |
51 | 52 | #include <linux/uio.h>
|
52 | 53 |
|
53 | 54 | #include <trace/events/sunrpc.h>
|
@@ -376,6 +377,26 @@ xs_read_discard(struct socket *sock, struct msghdr *msg, int flags,
|
376 | 377 | return sock_recvmsg(sock, msg, flags);
|
377 | 378 | }
|
378 | 379 |
|
| 380 | +#if ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE |
| 381 | +static void |
| 382 | +xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek) |
| 383 | +{ |
| 384 | + struct bvec_iter bi = { |
| 385 | + .bi_size = count, |
| 386 | + }; |
| 387 | + struct bio_vec bv; |
| 388 | + |
| 389 | + bvec_iter_advance(bvec, &bi, seek & PAGE_MASK); |
| 390 | + for_each_bvec(bv, bvec, bi, bi) |
| 391 | + flush_dcache_page(bv.bv_page); |
| 392 | +} |
| 393 | +#else |
| 394 | +static inline void |
| 395 | +xs_flush_bvec(const struct bio_vec *bvec, size_t count, size_t seek) |
| 396 | +{ |
| 397 | +} |
| 398 | +#endif |
| 399 | + |
379 | 400 | static ssize_t
|
380 | 401 | xs_read_xdr_buf(struct socket *sock, struct msghdr *msg, int flags,
|
381 | 402 | 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,
|
409 | 430 | seek + buf->page_base);
|
410 | 431 | if (ret <= 0)
|
411 | 432 | goto sock_err;
|
| 433 | + xs_flush_bvec(buf->bvec, ret, seek + buf->page_base); |
412 | 434 | offset += ret - buf->page_base;
|
413 | 435 | if (offset == count || msg->msg_flags & (MSG_EOR|MSG_TRUNC))
|
414 | 436 | goto out;
|
|
0 commit comments