request->resend_mds = use_mds;
while (1) {
- if (request->aborted)
+ if (request->aborted())
break;
// set up wait cond
wait_on_context_list(session->waiting_for_open);
// Abort requests on REJECT from MDS
if (rejected_by_mds.count(mds)) {
- request->aborted = true;
+ request->abort(-EPERM);
break;
}
continue;
}
if (!request->reply) {
- assert(request->aborted);
+ assert(request->aborted());
assert(!request->got_unsafe);
request->item.remove_myself();
unregister_request(request);
put_request(request); // ours
- return -ETIMEDOUT;
+ return request->get_abort_code();
}
// got it!
if (!mounted && !mds_requests.empty()) {
MetaRequest *req = mds_requests.begin()->second;
if (req->op_stamp + cct->_conf->client_mount_timeout < now) {
- req->aborted = true;
+ req->abort(-ETIMEDOUT);
if (req->caller_cond) {
req->kick = true;
req->caller_cond->Signal();
InodeRef _inode, _old_inode, _other_inode;
Dentry *_dentry; //associated with path
Dentry *_old_dentry; //associated with path2
+ int abort_rc;
public:
uint64_t tid;
utime_t op_stamp;
MClientReply *reply; // the reply
bool kick;
- bool aborted;
bool success;
// readdir result
InodeRef target;
MetaRequest(int op) :
- _dentry(NULL), _old_dentry(NULL),
+ _dentry(NULL), _old_dentry(NULL), abort_rc(0),
tid(0),
inode_drop(0), inode_unless(0),
old_inode_drop(0), old_inode_unless(0),
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), success(false),
+ kick(false), success(false),
readdir_offset(0), readdir_end(false), readdir_num(0),
got_unsafe(false), item(this), unsafe_item(this), unsafe_dir_item(this),
lock("MetaRequest lock"),
}
~MetaRequest();
+ /**
+ * Prematurely terminate the request, such that callers
+ * to make_request will receive `rc` as their result.
+ */
+ void abort(int rc)
+ {
+ assert(rc != 0);
+ abort_rc = rc;
+ }
+
+ /**
+ * Whether abort() has been called for this request
+ */
+ inline bool aborted() const
+ {
+ return abort_rc != 0;
+ }
+
+ /**
+ * Given that abort() has been called for this request, what `rc` was
+ * passed into it?
+ */
+ int get_abort_code() const
+ {
+ return abort_rc;
+ }
+
void set_inode(Inode *in) {
_inode = in;
}