]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
ceph: fix caps usage accounting for import (non-reserved) case
authorSage Weil <sage@newdream.net>
Tue, 29 Jun 2010 16:28:39 +0000 (09:28 -0700)
committerSage Weil <sage@newdream.net>
Tue, 29 Jun 2010 16:31:56 +0000 (09:31 -0700)
We need to increase the total and used counters when allocating a new cap
in the non-reserved (cap import) case.

Signed-off-by: Sage Weil <sage@newdream.net>
fs/ceph/caps.c

index d4fcdda7676c6399bd67567b0e631c36a3df52ab..74144d6389f0af2181d0f1e22fb4ae67c9839ca5 100644 (file)
@@ -244,8 +244,14 @@ static struct ceph_cap *get_cap(struct ceph_cap_reservation *ctx)
        struct ceph_cap *cap = NULL;
 
        /* temporary, until we do something about cap import/export */
-       if (!ctx)
-               return kmem_cache_alloc(ceph_cap_cachep, GFP_NOFS);
+       if (!ctx) {
+               cap = kmem_cache_alloc(ceph_cap_cachep, GFP_NOFS);
+               if (cap) {
+                       caps_use_count++;
+                       caps_total_count++;
+               }
+               return cap;
+       }
 
        spin_lock(&caps_list_lock);
        dout("get_cap ctx=%p (%d) %d = %d used + %d resv + %d avail\n",