// [auth] twiddle mode?
eval(in, CEPH_CAP_LOCKS);
- if (_need_flush_mdlog(in, my_want))
+ if (_need_flush_mdlog(in, my_want, true))
mds->mdlog->flush();
} else {
}
}
-bool Locker::_need_flush_mdlog(CInode *in, int wanted)
+bool Locker::_need_flush_mdlog(CInode *in, int wanted, bool lock_state_any)
{
/* flush log if caps are wanted by client but corresponding lock is unstable and locked by
* pending mutations. */
if (((wanted & (CEPH_CAP_FILE_RD|CEPH_CAP_FILE_WR|CEPH_CAP_FILE_SHARED|CEPH_CAP_FILE_EXCL)) &&
- in->filelock.is_unstable_and_locked()) ||
+ (lock_state_any ? in->filelock.is_locked() : in->filelock.is_unstable_and_locked())) ||
((wanted & (CEPH_CAP_AUTH_SHARED|CEPH_CAP_AUTH_EXCL)) &&
- in->authlock.is_unstable_and_locked()) ||
+ (lock_state_any ? in->authlock.is_locked() : in->authlock.is_unstable_and_locked())) ||
((wanted & (CEPH_CAP_LINK_SHARED|CEPH_CAP_LINK_EXCL)) &&
- in->linklock.is_unstable_and_locked()) ||
+ (lock_state_any ? in->linklock.is_locked() : in->linklock.is_unstable_and_locked())) ||
((wanted & (CEPH_CAP_XATTR_SHARED|CEPH_CAP_XATTR_EXCL)) &&
- in->xattrlock.is_unstable_and_locked()))
+ (lock_state_any ? in->xattrlock.is_locked() : in->xattrlock.is_unstable_and_locked())))
return true;
return false;
}
void scatter_writebehind_finish(ScatterLock *lock, MutationRef& mut);
- bool _need_flush_mdlog(CInode *in, int wanted_caps);
+ bool _need_flush_mdlog(CInode *in, int wanted_caps, bool lock_state_any=false);
void adjust_cap_wanted(Capability *cap, int wanted, int issue_seq);
void handle_client_caps(const cref_t<MClientCaps> &m);
void _update_cap_fields(CInode *in, int dirty, const cref_t<MClientCaps> &m, CInode::mempool_inode *pi);
return get_sm()->states[state].next == 0;
}
bool is_unstable_and_locked() const {
- if (is_stable())
- return false;
+ return (!is_stable() && is_locked());
+ }
+ bool is_locked() const {
return is_rdlocked() || is_wrlocked() || is_xlocked();
}
int get_next_state() {