@@ -812,12 +812,12 @@ static size_t svc_tcp_restore_pages(struct svc_sock *svsk,
if (!len)
return 0;
npages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT;
- for (i = 0; i < npages; i++) {
- if (rqstp->rq_pages[i] != NULL)
- put_page(rqstp->rq_pages[i]);
- BUG_ON(svsk->sk_pages[i] == NULL);
- rqstp->rq_pages[i] = svsk->sk_pages[i];
- svsk->sk_pages[i] = NULL;
+ if (npages) {
+ release_pages(rqstp->rq_pages, npages);
+ for (i = 0; i < npages; i++) {
+ rqstp->rq_pages[i] = svsk->sk_pages[i];
+ svsk->sk_pages[i] = NULL;
+ }
}
rqstp->rq_arg.head[0].iov_base = page_address(rqstp->rq_pages[0]);
return len;