Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mimic: mds: wait for client to release shared cap when re-acquiring xlock #27023

Merged
merged 1 commit into from Apr 29, 2019
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -763,8 +763,7 @@ void Locker::cancel_locking(MutationImpl *mut, set<CInode*> *pneed_issue)
bool need_issue = false;
if (lock->get_state() == LOCK_PREXLOCK) {
_finish_xlock(lock, -1, &need_issue);
} else if (lock->get_state() == LOCK_LOCK_XLOCK &&
lock->get_num_xlocks() == 0) {
} else if (lock->get_state() == LOCK_LOCK_XLOCK) {
lock->set_state(LOCK_XLOCKDONE);
eval_gather(lock, true, &need_issue);
}
@@ -1650,11 +1649,17 @@ bool Locker::xlock_start(SimpleLock *lock, MDRequestRef& mut)
dout(7) << "xlock_start on " << *lock << " on " << *lock->get_parent() << dendl;
client_t client = mut->get_client();

CInode *in = nullptr;
if (lock->get_cap_shift())
in = static_cast<CInode *>(lock->get_parent());

// auth?
if (lock->get_parent()->is_auth()) {
// auth
while (1) {
if (lock->can_xlock(client)) {
if (lock->can_xlock(client) &&
!(lock->get_state() == LOCK_LOCK_XLOCK && // client is not xlocker or
in && in->issued_caps_need_gather(lock))) { // xlocker does not hold shared cap
lock->set_state(LOCK_XLOCK);
lock->get_xlock(mut, client);
mut->xlocks.insert(lock);
@@ -1663,11 +1668,9 @@ bool Locker::xlock_start(SimpleLock *lock, MDRequestRef& mut)
return true;
}

if (lock->get_type() == CEPH_LOCK_IFILE) {
CInode *in = static_cast<CInode*>(lock->get_parent());
if (in->state_test(CInode::STATE_RECOVERING)) {
mds->mdcache->recovery_queue.prioritize(in);
}
if (lock->get_type() == CEPH_LOCK_IFILE &&
in->state_test(CInode::STATE_RECOVERING)) {
mds->mdcache->recovery_queue.prioritize(in);
}

if (!lock->is_stable() && (lock->get_state() != LOCK_XLOCKDONE ||
@@ -1789,9 +1792,8 @@ void Locker::xlock_finish(SimpleLock *lock, MutationImpl *mut, bool *pneed_issue
SimpleLock::WAIT_WR |
SimpleLock::WAIT_RD, 0);
} else {
if (lock->get_num_xlocks() == 0) {
if (lock->get_state() == LOCK_LOCK_XLOCK)
lock->set_state(LOCK_XLOCKDONE);
if (lock->get_num_xlocks() == 0 &&
lock->get_state() != LOCK_LOCK_XLOCK) { // no one is taking xlock
_finish_xlock(lock, xlocker, &do_issue);
}
}
@@ -506,8 +506,9 @@ class SimpleLock {
}
void put_xlock() {
assert(state == LOCK_XLOCK || state == LOCK_XLOCKDONE ||
state == LOCK_XLOCKSNAP || is_locallock() ||
state == LOCK_LOCK /* if we are a master of a slave */);
state == LOCK_XLOCKSNAP || state == LOCK_LOCK_XLOCK ||
state == LOCK_LOCK || /* if we are a master of a slave */
is_locallock());
--more()->num_xlock;
parent->put(MDSCacheObject::PIN_LOCK);
if (more()->num_xlock == 0) {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.