mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
Merge pull request #4302 from ceph/wip-11339
client: drop inode when rmdir request finishes Reviewed-by: Sage Weil <sage@redhat.com> Reviewed-by: Greg Farnum <gfarnum@redhat.com>
This commit is contained in:
commit
c1de23ff45
@ -1556,6 +1556,8 @@ int Client::make_request(MetaRequest *request,
|
||||
MClientReply *reply = request->reply;
|
||||
request->reply = NULL;
|
||||
r = reply->get_result();
|
||||
if (r >= 0)
|
||||
request->success = true;
|
||||
|
||||
// kick dispatcher (we've got it!)
|
||||
assert(request->dispatch_cond);
|
||||
@ -1589,9 +1591,18 @@ void Client::put_request(MetaRequest *request)
|
||||
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());
|
||||
int op = -1;
|
||||
if (request->success)
|
||||
op = request->get_op();
|
||||
Inode *other_in = request->take_other_inode();
|
||||
delete request;
|
||||
|
||||
if (other_in) {
|
||||
if (other_in->dir &&
|
||||
(op == CEPH_MDS_OP_RMDIR || op == CEPH_MDS_OP_RENAME))
|
||||
_try_to_trim_inode(other_in);
|
||||
put_inode(other_in);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -9374,7 +9385,7 @@ int Client::_rmdir(Inode *dir, const char *name, int uid, int gid)
|
||||
|
||||
req->dentry_drop = CEPH_CAP_FILE_SHARED;
|
||||
req->dentry_unless = CEPH_CAP_FILE_EXCL;
|
||||
req->inode_drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL;
|
||||
req->other_inode_drop = CEPH_CAP_LINK_SHARED | CEPH_CAP_LINK_EXCL;
|
||||
|
||||
Dentry *de;
|
||||
int res = get_or_create(dir, name, &de);
|
||||
@ -9386,7 +9397,7 @@ int Client::_rmdir(Inode *dir, const char *name, int uid, int gid)
|
||||
goto fail;
|
||||
if (req->get_op() == CEPH_MDS_OP_RMDIR) {
|
||||
req->set_dentry(de);
|
||||
req->set_inode(in);
|
||||
req->set_other_inode(in);
|
||||
} else {
|
||||
unlink(de, true, true);
|
||||
}
|
||||
|
@ -54,6 +54,7 @@ public:
|
||||
MClientReply *reply; // the reply
|
||||
bool kick;
|
||||
bool aborted;
|
||||
bool success;
|
||||
|
||||
// readdir result
|
||||
frag_t readdir_frag;
|
||||
@ -91,7 +92,7 @@ public:
|
||||
mds(-1), resend_mds(-1), send_to_auth(false), sent_on_mseq(0),
|
||||
num_fwd(0), retry_attempt(0),
|
||||
ref(1), reply(0),
|
||||
kick(false), aborted(false),
|
||||
kick(false), aborted(false), success(false),
|
||||
readdir_offset(0), readdir_end(false), readdir_num(0),
|
||||
got_unsafe(false), item(this), unsafe_item(this),
|
||||
lock("MetaRequest lock"),
|
||||
|
Loading…
Reference in New Issue
Block a user