]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: use put_inode on MetaRequest inode refs
authorSage Weil <sage@inktank.com>
Fri, 28 Jun 2013 04:39:35 +0000 (21:39 -0700)
committerSage Weil <sage@inktank.com>
Fri, 28 Jun 2013 04:39:35 +0000 (21:39 -0700)
When we drop the request inode refs, we need to use put_inode() to ensure
they get cleaned up properly (removed from inode_map, caps released, etc.).
Do this explicitly here (as we do with all other inode put() paths that
matter).

Fixes: #5381
Backport: cuttlefish
Signed-off-by: Sage Weil <sage@inktank.com>
src/client/Client.cc
src/client/MetaRequest.cc
src/client/MetaRequest.h

index 45ad949cb73bf33777bfdd3eedee6d43ec8a172a..f89699ab67e81f01bae0903eab562c7dbf64867a 100644 (file)
@@ -1354,6 +1354,13 @@ int Client::make_request(MetaRequest *request,
   logger->tinc(l_c_lat, lat);
   logger->tinc(l_c_reply, lat);
 
+  if (request->inode())
+    put_inode(request->take_inode());
+  if (request->old_inode())
+    put_inode(request->take_old_inode());
+  if (request->other_inode())
+    put_inode(request->take_other_inode());
+
   request->put();
 
   reply->put();
index b6935f970fbbbe530faa2539d78c447f572a602b..c8c4552d007a318427d4388616d0c462a12e8005 100644 (file)
@@ -57,12 +57,9 @@ void MetaRequest::dump(Formatter *f) const
 
 MetaRequest::~MetaRequest()
 {
-  if (_inode)
-    _inode->put();
-  if (_old_inode)
-    _old_inode->put();
-  if (_other_inode)
-    _other_inode->put();
+  assert(!_inode);
+  assert(!_old_inode);
+  assert(!_other_inode);
   if (_dentry)
     _dentry->put();
   if (_old_dentry)
index 465e88562fd9bb53bd5aa4a34d7c29d7bc6a1010..ff96cbc239a19f22d691cb1de9cadf71e86af642 100644 (file)
@@ -100,10 +100,25 @@ public:
 
   void set_inode(Inode *in);
   Inode *inode();
+  Inode *take_inode() {
+    Inode *i = _inode;
+    _inode = 0;
+    return i;
+  }
   void set_old_inode(Inode *in);
   Inode *old_inode();
+  Inode *take_old_inode() {
+    Inode *i = _old_inode;
+    _old_inode = NULL;
+    return i;
+  }
   void set_other_inode(Inode *in);
   Inode *other_inode();
+  Inode *take_other_inode() {
+    Inode *i = _other_inode;
+    _other_inode = 0;
+    return i;
+  }
   void set_dentry(Dentry *d);
   Dentry *dentry();
   void set_old_dentry(Dentry *d);