client: use put_inode on MetaRequest inode refs

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>
This commit is contained in:
Sage Weil 2013-06-27 21:39:35 -07:00
parent 9e604ee694
commit 81bee6487f
3 changed files with 25 additions and 6 deletions

View File

@ -1354,6 +1354,13 @@ int Client::make_request(MetaRequest *request,
logger->tinc(l_c_lat, lat); logger->tinc(l_c_lat, lat);
logger->tinc(l_c_reply, 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(); request->put();
reply->put(); reply->put();

View File

@ -57,12 +57,9 @@ void MetaRequest::dump(Formatter *f) const
MetaRequest::~MetaRequest() MetaRequest::~MetaRequest()
{ {
if (_inode) assert(!_inode);
_inode->put(); assert(!_old_inode);
if (_old_inode) assert(!_other_inode);
_old_inode->put();
if (_other_inode)
_other_inode->put();
if (_dentry) if (_dentry)
_dentry->put(); _dentry->put();
if (_old_dentry) if (_old_dentry)

View File

@ -100,10 +100,25 @@ public:
void set_inode(Inode *in); void set_inode(Inode *in);
Inode *inode(); Inode *inode();
Inode *take_inode() {
Inode *i = _inode;
_inode = 0;
return i;
}
void set_old_inode(Inode *in); void set_old_inode(Inode *in);
Inode *old_inode(); Inode *old_inode();
Inode *take_old_inode() {
Inode *i = _old_inode;
_old_inode = NULL;
return i;
}
void set_other_inode(Inode *in); void set_other_inode(Inode *in);
Inode *other_inode(); Inode *other_inode();
Inode *take_other_inode() {
Inode *i = _other_inode;
_other_inode = 0;
return i;
}
void set_dentry(Dentry *d); void set_dentry(Dentry *d);
Dentry *dentry(); Dentry *dentry();
void set_old_dentry(Dentry *d); void set_old_dentry(Dentry *d);