it != in.get_client_caps().end();
it++) {
if (it != in.get_client_caps().begin()) out << ",";
- out << it->first;
+ out << it->first << "=" << it->second->issued();
}
out << "}";
}
}
return w;
}
+ bool is_loner_cap() {
+ if (!mds_caps_wanted.empty())
+ return false;
+ int n = 0;
+ for (map<int,Capability*>::iterator it = client_caps.begin();
+ it != client_caps.end();
+ it++)
+ if (!it->second->is_stale()) {
+ if (n) return false;
+ n++;
+ }
+ return (n == 1);
+ }
void replicate_relax_locks() {
//dout(10) << " relaxing locks on " << *this << dendl;
if (issued) {
dout(10) << " revoking " << cap_string(issued) << " on " << *in << dendl;
cap->revoke();
- file_eval(&in->filelock);
- if (!in->is_auth())
+ file_eval_gather(&in->filelock);
+ if (in->is_auth()) {
+ if (in->filelock.is_stable())
+ file_eval(&in->filelock);
+ } else {
request_inode_file_caps(in);
+ }
} else {
dout(10) << " nothing issued on " << *in << dendl;
}
if (cap->is_stale()) {
dout(10) << " clearing stale flag on " << *in << dendl;
cap->set_stale(false);
- file_eval(&in->filelock);
+ if (in->is_auth() && in->filelock.is_stable())
+ file_eval(&in->filelock);
issue_caps(in);
}
}
{
CInode *in = (CInode*)lock->get_parent();
int wanted = in->get_caps_wanted();
- bool loner = (in->client_caps.size() == 1) && in->mds_caps_wanted.empty();
+ bool loner = in->is_loner_cap();
dout(7) << "file_eval wanted=" << cap_string(wanted)
<< " filelock=" << *lock << " on " << *lock->get_parent()
<< " loner=" << loner
dout(10) << "new stale session " << session->inst << " last " << session->last_cap_renew << dendl;
mds->sessionmap.set_state(session, Session::STATE_STALE);
mds->locker->revoke_stale_caps(session);
- mds->messenger->send_message(new MClientSession(CEPH_SESSION_STALE, g_clock.now()),
+ mds->messenger->send_message(new MClientSession(CEPH_SESSION_STALE, session->get_push_seq()),
session->inst);
}
}
int32_t op;
- version_t seq; // used when requesting close only
+ version_t seq; // used when requesting close, declaring stale
utime_t stamp;
MClientSession() : Message(CEPH_MSG_CLIENT_SESSION) { }