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>
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();
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)
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);