mirror of
https://github.com/ceph/ceph
synced 2025-02-22 18:47:18 +00:00
mds: fix xlock state asserts for LocalLock
The LocalLock (versionlocks) allow xlocking but have only a single state (LOCK_LOCK). Signed-off-by: Sage Weil <sage@newdream.net>
This commit is contained in:
parent
1d7eb8a082
commit
44587aaf5c
@ -27,6 +27,10 @@ public:
|
||||
set_state(LOCK_LOCK); // always.
|
||||
}
|
||||
|
||||
bool is_locallock() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool can_wrlock() {
|
||||
return !is_xlocked();
|
||||
}
|
||||
|
@ -223,6 +223,9 @@ public:
|
||||
virtual bool is_scatterlock() const {
|
||||
return false;
|
||||
}
|
||||
virtual bool is_locallock() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
// parent
|
||||
MDSCacheObject *get_parent() { return parent; }
|
||||
@ -446,7 +449,7 @@ public:
|
||||
// xlock
|
||||
void get_xlock(Mutation *who, client_t client) {
|
||||
assert(get_xlock_by() == 0);
|
||||
assert(state == LOCK_XLOCK);
|
||||
assert(state == LOCK_XLOCK || is_locallock());
|
||||
parent->get(MDSCacheObject::PIN_LOCK);
|
||||
more()->num_xlock++;
|
||||
more()->xlock_by = who;
|
||||
@ -454,12 +457,13 @@ public:
|
||||
}
|
||||
void set_xlock_done() {
|
||||
assert(more()->xlock_by);
|
||||
assert(state == LOCK_XLOCK);
|
||||
state = LOCK_XLOCKDONE;
|
||||
assert(state == LOCK_XLOCK || is_locallock());
|
||||
if (!is_locallock())
|
||||
state = LOCK_XLOCKDONE;
|
||||
more()->xlock_by = 0;
|
||||
}
|
||||
void put_xlock() {
|
||||
assert(state == LOCK_XLOCK || state == LOCK_XLOCKDONE);
|
||||
assert(state == LOCK_XLOCK || state == LOCK_XLOCKDONE || is_locallock());
|
||||
--more()->num_xlock;
|
||||
parent->put(MDSCacheObject::PIN_LOCK);
|
||||
if (more()->num_xlock == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user