summaryrefslogtreecommitdiffstats
path: root/src/mds/flock.cc
diff options
context:
space:
mode:
authorGreg Farnum <gregory.farnum@dreamhost.com>2011-09-19 18:48:13 +0200
committerGreg Farnum <gregory.farnum@dreamhost.com>2011-09-19 18:48:13 +0200
commitd440a67412f385572edefae65c3b612ce562d710 (patch)
tree4e3bb040c26559ef0be5e8f2325dc764ea515865 /src/mds/flock.cc
parentflock: add a replay parameter to add_lock (diff)
downloadceph-d440a67412f385572edefae65c3b612ce562d710.tar.xz
ceph-d440a67412f385572edefae65c3b612ce562d710.zip
flock: clean up waiting records of a lock when adding it succeeds
Signed-off-by: Greg Farnum <gregory.farnum@dreamhost.com>
Diffstat (limited to '')
-rw-r--r--src/mds/flock.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mds/flock.cc b/src/mds/flock.cc
index cc3eeb615b0..a3cac9e46e4 100644
--- a/src/mds/flock.cc
+++ b/src/mds/flock.cc
@@ -33,6 +33,10 @@ void ceph_lock_state_t::remove_waiting(ceph_filelock& fl)
p->second.pid == fl.pid &&
p->second.pid_namespace == fl.pid_namespace) {
waiting_locks.erase(p);
+ --client_waiting_lock_counts[(client_t)fl.client];
+ if (!client_waiting_lock_counts[(client_t)fl.client]) {
+ client_waiting_lock_counts.erase((client_t)fl.client);
+ }
return;
}
++p;
@@ -81,8 +85,10 @@ bool ceph_lock_state_t::add_lock(ceph_filelock& new_lock,
(new_lock.start, new_lock));
ret = true;
}
- if (ret)
+ if (ret) {
++client_held_lock_counts[(client_t)new_lock.client];
+ remove_waiting(new_lock);
+ }
else if (wait_on_fail && !replay)
++client_waiting_lock_counts[(client_t)new_lock.client];
return ret;