]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: fix SnapRealm leak
authorSage Weil <sage@inktank.com>
Fri, 9 Nov 2012 18:12:21 +0000 (10:12 -0800)
committerSage Weil <sage@inktank.com>
Fri, 9 Nov 2012 18:12:21 +0000 (10:12 -0800)
Start ref count at 0; get_snap_realm() will increment it after alloc.

Fix the ref drop order so that the xlist is empty.

Signed-off-by: Sage Weil <sage@inktank.com>
src/client/Client.cc
src/client/SnapRealm.h

index 742ffa42a68a4f6ff4eb531bf4919e87d4e3f242..ffc67ed19314a563e912008b7e21af50608ad410 100644 (file)
@@ -2607,9 +2607,9 @@ void Client::remove_cap(Cap *cap)
 
   if (!in->is_any_caps()) {
     ldout(cct, 15) << "remove_cap last one, closing snaprealm " << in->snaprealm << dendl;
+    in->snaprealm_item.remove_myself();
     put_snap_realm(in->snaprealm);
     in->snaprealm = 0;
-    in->snaprealm_item.remove_myself();
   }
 }
 
index b99fd6e86dd3af3ed82f26219ebcb2724346c153..839c68aef696a77e848407f71dbc0721fd910e0e 100644 (file)
@@ -25,7 +25,7 @@ public:
   xlist<Inode*> inodes_with_caps;
 
   SnapRealm(inodeno_t i) : 
-    ino(i), nref(1), created(0), seq(0),
+    ino(i), nref(0), created(0), seq(0),
     pparent(NULL) { }
 
   void build_snap_context();