ceph_assert(lock_cache->item_cap_lock_cache.is_on_list());
ceph_assert(!lock_cache->invalidating);
lock_cache->invalidating = true;
+ lock_cache->detach_all();
// XXX check issued caps
lock_cache->item_cap_lock_cache.remove_myself();
put_lock_cache(lock_cache);
}
+// ask lock caches to release locks
+void Locker::invalidate_lock_caches(SimpleLock *lock)
+{
+ dout(10) << "invalidate_lock_caches " << *lock << " on " << *lock->get_parent() << dendl;
+ while (lock->is_cached()) {
+ invalidate_lock_cache(lock->get_first_cache());
+ }
+}
+
void Locker::create_lock_cache(MDRequestRef& mdr, CInode *diri)
{
if (mdr->lock_cache)
++it;
}
}
+ lock_cache->attach_locks();
lock_cache->ref++;
mdr->lock_cache = lock_cache;
else
mut->locks.erase(it);
- if (!lock->is_wrlocked()) {
+ if (lock->is_wrlocked()) {
+ // Evaluate unstable lock after scatter_writebehind_finish(). Because
+ // eval_gather() does not change lock's state when lock is flushing.
+ if (!lock->is_stable() && lock->is_flushed() &&
+ lock->get_parent()->is_auth())
+ eval_gather(lock, false, pneed_issue);
+ } else {
if (!lock->is_stable())
eval_gather(lock, false, pneed_issue);
else if (lock->get_parent()->is_auth())
if (lock->is_leased())
revoke_client_leases(lock);
eval_gather(lock, true);
- if (lock->is_unstable_and_locked())
+ if (lock->is_unstable_and_locked()) {
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
mds->mdlog->flush();
+ }
break;
}
int gather = 0;
- if (lock->is_wrlocked())
+ if (lock->is_wrlocked()) {
gather++;
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
+ }
if (lock->get_parent()->is_replicated() && old_state == LOCK_MIX) {
send_lock_message(lock, LOCK_AC_SYNC);
gather++;
if (lock->is_wrlocked())
gather++;
+ if (gather && lock->is_cached())
+ invalidate_lock_caches(lock);
if (lock->get_parent()->is_replicated() &&
lock->get_state() != LOCK_LOCK_EXCL &&
gather++;
revoke_client_leases(lock);
}
- if (lock->is_rdlocked())
+ if (lock->is_rdlocked()) {
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
gather++;
+ }
if (in && in->is_head()) {
if (in->issued_caps_need_gather(lock)) {
if (need_issue)
gather++;
if (lock->is_wrlocked())
gather++;
+ if (gather && lock->is_cached())
+ invalidate_lock_caches(lock);
if (in && in->is_head()) {
if (in->issued_caps_need_gather(lock)) {
}
int gather = 0;
- if (lock->is_wrlocked())
+ if (lock->is_wrlocked()) {
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
gather++;
+ }
if (lock->get_cap_shift() &&
in->is_head() &&
}
int gather = 0;
- if (lock->is_rdlocked())
+ if (lock->is_rdlocked()) {
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
gather++;
+ }
if (in->is_replicated()) {
if (lock->get_state() == LOCK_SYNC_MIX) { // for the rest states, replicas are already LOCK
send_lock_message(lock, LOCK_AC_MIX);
gather++;
if (lock->is_wrlocked())
gather++;
+ if (gather && lock->is_cached())
+ invalidate_lock_caches(lock);
if (in->is_replicated() &&
lock->get_state() != LOCK_LOCK_EXCL &&
}
int gather = 0;
- if (lock->is_wrlocked())
+ if (lock->is_wrlocked()) {
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
gather++;
+ }
if (in->is_head() &&
in->issued_caps_need_gather(lock)) {
if (lock->get_state() == LOCK_MIX) {
lock->set_state(LOCK_MIX_SYNC);
eval_gather(lock, true);
- if (lock->is_unstable_and_locked())
+ if (lock->is_unstable_and_locked()) {
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
mds->mdlog->flush();
+ }
break;
}
}
eval_gather(lock, true);
- if (lock->is_unstable_and_locked())
+ if (lock->is_unstable_and_locked()) {
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
mds->mdlog->flush();
+ }
break;
// MIXED
lock->set_state(LOCK_SYNC_MIX);
eval_gather(lock, true);
- if (lock->is_unstable_and_locked())
+ if (lock->is_unstable_and_locked()) {
+ if (lock->is_cached())
+ invalidate_lock_caches(lock);
mds->mdlog->flush();
+ }
break;
}