projected_version = committing_version = committed_version = got_fnode.version;
if (fnode.rstat.version < inode->inode.rstat.version)
- inode->nestlock.set_and_apply_stale();
+ inode->nestlock.set_or_apply_stale();
if (fnode.fragstat.version < inode->inode.dirstat.version)
- inode->filelock.set_and_apply_stale();
+ inode->filelock.set_or_apply_stale();
}
// purge stale snaps?
inode_t *pi = inode->get_projected_inode();
if (fnode.fragstat.version != pi->dirstat.version) {
dout(10) << " got stale fragstat " << fnode.fragstat << " vs inode " << pi->dirstat << dendl;
- inode->filelock.set_and_apply_stale();
+ inode->filelock.set_or_apply_stale();
}
// stale rstat?
if (fnode.rstat.version != pi->rstat.version) {
dout(10) << " got stale rstat " << fnode.rstat << " vs inode " << pi->rstat << dendl;
- inode->nestlock.set_and_apply_stale();
+ inode->nestlock.set_or_apply_stale();
}
}
::decode(authlock, p);
::decode(linklock, p);
::decode(dirfragtreelock, p);
+
+ if (filelock.get_state() == LOCK_MIX_STALE)
+ filelock.set_stale();
::decode(filelock, p);
filelock.apply_stale();
+
::decode(xattrlock, p);
::decode(snaplock, p);
+
+ if (nestlock.get_state() == LOCK_MIX_STALE)
+ nestlock.set_stale();
::decode(nestlock, p);
nestlock.apply_stale();
+
::decode(flocklock, p);
::decode(policylock, p);
}
if (issued & CEPH_CAP_GEXCL)
lock->set_state(LOCK_EXCL);
else if (issued & CEPH_CAP_GWR) {
- if (lock->is_stale())
- lock->set_state(LOCK_MIX_STALE);
- else
- lock->set_state(LOCK_MIX);
+ lock->set_state(LOCK_MIX);
+ ((ScatterLock *)lock)->apply_stale();
}
else if (lock->is_dirty()) {
if (is_replicated())
}
// change lock
- if (lock->is_stale())
- lock->set_state(LOCK_MIX_STALE);
- else
- lock->set_state(LOCK_MIX);
+ lock->set_state(LOCK_MIX);
+ lock->apply_stale();
lock->clear_scatter_wanted();
if (need_issue)
*need_issue = true;
lock->get_parent()->auth_pin(lock);
else {
in->start_scatter(lock);
- if (lock->is_stale())
- lock->set_state(LOCK_MIX_STALE);
- else
- lock->set_state(LOCK_MIX);
+ lock->set_state(LOCK_MIX);
+ lock->apply_stale();
lock->clear_scatter_wanted();
if (in->is_replicated()) {
bufferlist softdata;
// ok
lock->decode_locked_state(m->get_data());
- if (!lock->is_stale()) {
- dout(15) << "setting state to LOCK_MIX_STALE instead of LOCK_MIX" << dendl;
- lock->set_state(LOCK_MIX_STALE);
- } else
- lock->set_state(LOCK_MIX);
+ lock->set_state(LOCK_MIX);
+ lock->apply_stale();
((ScatterLock *)lock)->finish_flush();
// scatter the dirlock, just in case?
if (!survivor && in->is_dir() && in->has_subtree_root_dirfrag()) {
- if (in->filelock.is_stale())
- in->filelock.set_state(LOCK_MIX_STALE);
- else
- in->filelock.set_state(LOCK_MIX);
+ in->filelock.set_state(LOCK_MIX);
+ in->filelock.apply_stale();
}
if (ack) {
}
}
void apply_stale() {
- if (state == LOCK_MIX_STALE)
- set_stale();
- else if (is_stale() && state == LOCK_MIX)
+ if (state == LOCK_MIX && is_stale()) {
state = LOCK_MIX_STALE;
+ clear_stale();
+ }
}
- void set_and_apply_stale() {
- set_stale();
- if (state == LOCK_MIX)
+ void set_or_apply_stale() {
+ if (state == LOCK_MIX) {
state = LOCK_MIX_STALE;
+ clear_stale();
+ } else {
+ set_stale();
+ }
}
void set_last_scatter(utime_t t) { more()->last_scatter = t; }