diff --git a/src/client/Client.cc b/src/client/Client.cc index 45ad949cb73..f89699ab67e 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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(); diff --git a/src/client/MetaRequest.cc b/src/client/MetaRequest.cc index b6935f970fb..c8c4552d007 100644 --- a/src/client/MetaRequest.cc +++ b/src/client/MetaRequest.cc @@ -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) diff --git a/src/client/MetaRequest.h b/src/client/MetaRequest.h index 465e88562fd..ff96cbc239a 100644 --- a/src/client/MetaRequest.h +++ b/src/client/MetaRequest.h @@ -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);