Merge tag 'pm+acpi-4.6-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael...
[cascardo/linux.git] / net / sunrpc / cache.c
index 273bc3a..553bf95 100644 (file)
@@ -881,7 +881,7 @@ static ssize_t cache_downcall(struct address_space *mapping,
        char *kaddr;
        ssize_t ret = -ENOMEM;
 
-       if (count >= PAGE_CACHE_SIZE)
+       if (count >= PAGE_SIZE)
                goto out_slow;
 
        page = find_or_create_page(mapping, 0, GFP_KERNEL);
@@ -892,7 +892,7 @@ static ssize_t cache_downcall(struct address_space *mapping,
        ret = cache_do_downcall(kaddr, buf, count, cd);
        kunmap(page);
        unlock_page(page);
-       page_cache_release(page);
+       put_page(page);
        return ret;
 out_slow:
        return cache_slow_downcall(buf, count, cd);
@@ -1182,14 +1182,14 @@ int sunrpc_cache_pipe_upcall(struct cache_detail *detail, struct cache_head *h)
        }
 
        crq->q.reader = 0;
-       crq->item = cache_get(h);
        crq->buf = buf;
        crq->len = 0;
        crq->readers = 0;
        spin_lock(&queue_lock);
-       if (test_bit(CACHE_PENDING, &h->flags))
+       if (test_bit(CACHE_PENDING, &h->flags)) {
+               crq->item = cache_get(h);
                list_add_tail(&crq->q.list, &detail->queue);
-       else
+       else
                /* Lost a race, no longer PENDING, so don't enqueue */
                ret = -EAGAIN;
        spin_unlock(&queue_lock);