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);
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);
+ }
}
}
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);
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);
}
MClientReply *reply; // the reply
bool kick;
bool aborted;
+ bool success;
// readdir result
frag_t readdir_frag;
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"),