Commit 17fbcdf9 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull nfsd fix from Chuck Lever:
 "Fix non-page-aligned NFS READs"

* tag 'nfsd-5.11-3' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux:
  SUNRPC: Fix NFS READs that start at non-page-aligned offsets
parents 6157ce59 bad4c6eb
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -1113,14 +1113,15 @@ static int svc_tcp_sendmsg(struct socket *sock, struct msghdr *msg,
		unsigned int offset, len, remaining;
		struct bio_vec *bvec;

		bvec = xdr->bvec;
		offset = xdr->page_base;
		bvec = xdr->bvec + (xdr->page_base >> PAGE_SHIFT);
		offset = offset_in_page(xdr->page_base);
		remaining = xdr->page_len;
		flags = MSG_MORE | MSG_SENDPAGE_NOTLAST;
		while (remaining > 0) {
			if (remaining <= PAGE_SIZE && tail->iov_len == 0)
				flags = 0;
			len = min(remaining, bvec->bv_len);

			len = min(remaining, bvec->bv_len - offset);
			ret = kernel_sendpage(sock, bvec->bv_page,
					      bvec->bv_offset + offset,
					      len, flags);