Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
[safe/jmp/linux-2.6] / fs / fscache / cookie.c
index 432482e..9905350 100644 (file)
@@ -36,6 +36,7 @@ void fscache_cookie_init_once(void *_cookie)
 
        memset(cookie, 0, sizeof(*cookie));
        spin_lock_init(&cookie->lock);
+       spin_lock_init(&cookie->stores_lock);
        INIT_HLIST_HEAD(&cookie->backing_objects);
 }
 
@@ -102,7 +103,9 @@ struct fscache_cookie *__fscache_acquire_cookie(
        cookie->netfs_data      = netfs_data;
        cookie->flags           = 0;
 
-       INIT_RADIX_TREE(&cookie->stores, GFP_NOFS);
+       /* radix tree insertion won't use the preallocation pool unless it's
+        * told it may not wait */
+       INIT_RADIX_TREE(&cookie->stores, GFP_NOFS & ~__GFP_WAIT);
 
        switch (cookie->def->type) {
        case FSCACHE_COOKIE_TYPE_INDEX:
@@ -412,6 +415,8 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
        unsigned long event;
 
        fscache_stat(&fscache_n_relinquishes);
+       if (retire)
+               fscache_stat(&fscache_n_relinquishes_retire);
 
        if (!cookie) {
                fscache_stat(&fscache_n_relinquishes_null);
@@ -437,12 +442,8 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
 
        event = retire ? FSCACHE_OBJECT_EV_RETIRE : FSCACHE_OBJECT_EV_RELEASE;
 
-       /* detach pointers back to the netfs */
        spin_lock(&cookie->lock);
 
-       cookie->netfs_data      = NULL;
-       cookie->def             = NULL;
-
        /* break links with all the active objects */
        while (!hlist_empty(&cookie->backing_objects)) {
                object = hlist_entry(cookie->backing_objects.first,
@@ -465,6 +466,10 @@ void __fscache_relinquish_cookie(struct fscache_cookie *cookie, int retire)
                        BUG();
        }
 
+       /* detach pointers back to the netfs */
+       cookie->netfs_data      = NULL;
+       cookie->def             = NULL;
+
        spin_unlock(&cookie->lock);
 
        if (cookie->parent) {