mds: fix dentry lease mask/lockid disconnect

There is only one lock here, no need to be tricky with the mask.
This commit is contained in:
Sage Weil 2010-07-23 15:39:53 -07:00
parent c33171c0aa
commit 74fcb6bf78

View File

@ -520,17 +520,9 @@ ClientLease *CDentry::add_client_lease(client_t c, int mask, Session *session)
<< " -> " << adding
<< " ... now " << (l->mask | mask)
<< dendl;
int b = 0;
while (adding) {
if (adding & 1) {
SimpleLock *lock = get_lock(1 << b);
if (lock) {
lock->get_client_lease();
dout(20) << "get_client_lease on " << (1 << b) << " " << *lock << dendl;
}
}
b++;
adding = adding >> 1;
if (adding) {
lock.get_client_lease();
dout(20) << "get_client_lease on " << lock << dendl;
}
l->mask |= mask;
@ -541,24 +533,16 @@ int CDentry::remove_client_lease(ClientLease *l, int mask, Locker *locker)
{
assert(l->parent == this);
list<SimpleLock*> to_gather;
bool gather = false;
int removing = l->mask & mask;
dout(20) << "had " << l->mask << " removing " << mask << " -> " << removing
<< " ... now " << (l->mask & ~mask) << dendl;
int b = 0;
while (removing) {
if (removing & 1) {
SimpleLock *lock = get_lock(1 << b);
if (lock) {
lock->put_client_lease();
dout(20) << "put_client_lease on " << (1 << b) << " " << *lock << dendl;
if (lock->get_num_client_lease() == 0 && !lock->is_stable())
to_gather.push_back(lock);
}
}
b++;
removing = removing >> 1;
if (removing) {
lock.put_client_lease();
dout(20) << "put_client_lease on " << lock << dendl;
if (lock.get_num_client_lease() == 0 && !lock.is_stable())
gather = true;
}
l->mask &= ~mask;
@ -574,11 +558,8 @@ int CDentry::remove_client_lease(ClientLease *l, int mask, Locker *locker)
put(PIN_CLIENTLEASE);
}
// do pending gathers.
while (!to_gather.empty()) {
locker->eval_gather(to_gather.front());
to_gather.pop_front();
}
if (gather)
locker->eval_gather(&lock);
return rc;
}