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:
Sage Weil 2010-09-24 15:54:57 -07:00
parent 1d7eb8a082
commit 44587aaf5c
2 changed files with 12 additions and 4 deletions

View File

@ -27,6 +27,10 @@ public:
set_state(LOCK_LOCK); // always.
}
bool is_locallock() const {
return true;
}
bool can_wrlock() {
return !is_xlocked();
}

View File

@ -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) {