// take note of latest distribution on mds's
dn->inode->mds_contacts = in_info->dist;
+ dn->inode->mds_auth = in_info->auth;
return dn->inode;
}
// -------
-MClientReply *Client::make_request(MClientRequest *req)
+MClientReply *Client::make_request(MClientRequest *req, bool auth_best)
{
// send to what MDS? find deepest known prefix
int mds = 0;
break;
}
- if (cur && cur->mds_contacts.size()) {
- dout(9) << "contacting mds from deepest inode " << cur->inode.ino << " " << req->get_filepath() << ": " << cur->mds_contacts << endl;
- set<int>::iterator it = cur->mds_contacts.begin();
- if (cur->mds_contacts.size() == 1)
- mds = *it;
- else {
- int r = rand() % cur->mds_contacts.size();
- while (r--) it++;
- mds = *it;
+ if (cur) {
+ if (auth_best) {
+ mds = cur->mds_auth;
+ } else {
+ if (cur->mds_contacts.size()) {
+ dout(9) << "contacting mds from deepest inode " << cur->inode.ino << " " << req->get_filepath() << ": " << cur->mds_contacts << endl;
+ set<int>::iterator it = cur->mds_contacts.begin();
+ if (cur->mds_contacts.size() == 1)
+ mds = *it;
+ else {
+ int r = rand() % cur->mds_contacts.size();
+ while (r--) it++;
+ mds = *it;
+ }
+ } else {
+ mds = cur->mds_auth;
+ }
}
} else {
dout(9) << "i have no idea where " << req->get_filepath() << " is" << endl;
req->set_caller_uid(getuid());
req->set_caller_gid(getgid());
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace());
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
if (res == 0) {
// remove from local cache
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace());
delete reply;
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace());
delete reply;
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
if (res == 0) {
// remove from local cache
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace()); //FIXME assuming trace of link, not of target
delete reply;
req->set_caller_uid(getuid());
req->set_caller_gid(getgid());
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace());
delete reply;
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace());
delete reply;
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace());
delete reply;
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace());
//FIXME enforce caller uid rights?
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
vector<c_inode_info*> trace = reply->get_trace();
this->insert_trace(trace);
req->set_caller_uid(getuid());
req->set_caller_gid(getgid());
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
assert(reply);
dout(3) << "op: open_files[" << reply->get_result() << "] = fh; // fh = " << reply->get_result() << endl;
tout << reply->get_result() << endl;
release_inode_buffers(in);
put_inode( in );
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
assert(reply);
int result = reply->get_result();
dout(3) << "close " << fh << " result = " << result << endl;
req->set_caller_uid(getuid());
req->set_caller_gid(getgid());
- MClientReply *reply = make_request(req);
+ MClientReply *reply = make_request(req, true);
int res = reply->get_result();
this->insert_trace(reply->get_trace());
delete reply;