mirror of
https://github.com/ceph/ceph
synced 2024-12-30 15:33:31 +00:00
client: send all request put's through put_request()
Make sure all MetaRequest reference put's go through the same path that releases inode references, including all of the error paths. Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
9af3b86b25
commit
87217e1e3c
@ -1354,19 +1354,25 @@ 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();
|
||||
put_request(request);
|
||||
|
||||
reply->put();
|
||||
return r;
|
||||
}
|
||||
|
||||
void Client::put_request(MetaRequest *request)
|
||||
{
|
||||
if (request->get_num_ref() == 1) {
|
||||
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();
|
||||
}
|
||||
|
||||
int Client::encode_inode_release(Inode *in, MetaRequest *req,
|
||||
int mds, int drop,
|
||||
int unless, int force)
|
||||
@ -1772,7 +1778,7 @@ void Client::handle_client_reply(MClientReply *reply)
|
||||
}
|
||||
request->item.remove_myself();
|
||||
mds_requests.erase(tid);
|
||||
request->put(); // for the dumb data structure
|
||||
put_request(request);
|
||||
}
|
||||
if (unmounting)
|
||||
mount_cond.Signal();
|
||||
@ -2064,7 +2070,6 @@ void Client::handle_lease(MClientLease *m)
|
||||
m->put();
|
||||
}
|
||||
|
||||
|
||||
void Client::put_inode(Inode *in, int n)
|
||||
{
|
||||
ldout(cct, 10) << "put_inode on " << *in << dendl;
|
||||
@ -4431,7 +4436,7 @@ int Client::_setattr(Inode *in, struct stat *attr, int mask, int uid, int gid, I
|
||||
if ((unsigned long)attr->st_size < mdsmap->get_max_filesize())
|
||||
req->head.args.setattr.size = attr->st_size;
|
||||
else { //too big!
|
||||
delete req;
|
||||
put_request(req);
|
||||
return -EFBIG;
|
||||
}
|
||||
req->inode_drop |= CEPH_CAP_AUTH_SHARED | CEPH_CAP_FILE_RD |
|
||||
@ -6974,7 +6979,7 @@ int Client::_mknod(Inode *dir, const char *name, mode_t mode, dev_t rdev, int ui
|
||||
return res;
|
||||
|
||||
fail:
|
||||
delete req;
|
||||
put_request(req);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -7070,7 +7075,7 @@ int Client::_create(Inode *dir, const char *name, int flags, mode_t mode, Inode
|
||||
return res;
|
||||
|
||||
fail:
|
||||
delete req;
|
||||
put_request(req);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -7114,7 +7119,7 @@ int Client::_mkdir(Inode *dir, const char *name, mode_t mode, int uid, int gid,
|
||||
return res;
|
||||
|
||||
fail:
|
||||
delete req;
|
||||
put_request(req);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -7179,7 +7184,7 @@ int Client::_symlink(Inode *dir, const char *name, const char *target, int uid,
|
||||
|
||||
|
||||
fail:
|
||||
delete req;
|
||||
put_request(req);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -7251,7 +7256,7 @@ int Client::_unlink(Inode *dir, const char *name, int uid, int gid)
|
||||
return res;
|
||||
|
||||
fail:
|
||||
delete req;
|
||||
put_request(req);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -7312,7 +7317,7 @@ int Client::_rmdir(Inode *dir, const char *name, int uid, int gid)
|
||||
return res;
|
||||
|
||||
fail:
|
||||
delete req;
|
||||
put_request(req);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -7395,7 +7400,7 @@ int Client::_rename(Inode *fromdir, const char *fromname, Inode *todir, const ch
|
||||
return res;
|
||||
|
||||
fail:
|
||||
delete req;
|
||||
put_request(req);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -7452,7 +7457,7 @@ int Client::_link(Inode *in, Inode *dir, const char *newname, int uid, int gid,
|
||||
return res;
|
||||
|
||||
fail:
|
||||
delete req;
|
||||
put_request(req);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
@ -254,6 +254,8 @@ public:
|
||||
//MClientRequest *req, int uid, int gid,
|
||||
Inode **ptarget = 0, bool *pcreated = 0,
|
||||
int use_mds=-1, bufferlist *pdirbl=0);
|
||||
void put_request(MetaRequest *request);
|
||||
|
||||
int verify_reply_trace(int r, MetaRequest *request, MClientReply *reply,
|
||||
Inode **ptarget, bool *pcreated, int uid, int gid);
|
||||
void encode_cap_releases(MetaRequest *request, int mds);
|
||||
|
@ -129,10 +129,14 @@ public:
|
||||
return this;
|
||||
}
|
||||
|
||||
void put() {
|
||||
/// psuedo-private put method; use Client::put_request()
|
||||
void _put() {
|
||||
if (--ref == 0)
|
||||
delete this;
|
||||
}
|
||||
int get_num_ref() {
|
||||
return ref;
|
||||
}
|
||||
|
||||
// normal fields
|
||||
void set_tid(tid_t t) { tid = t; }
|
||||
|
Loading…
Reference in New Issue
Block a user