mirror of
https://github.com/ceph/ceph
synced 2025-01-03 09:32:43 +00:00
common/shared_cache: dump weak refs on shutdown
Before asserting, dump what the refs are along with the counts. Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
6cf583c4b7
commit
f246b56926
@ -91,13 +91,29 @@ public:
|
||||
~SharedLRU() {
|
||||
contents.clear();
|
||||
lru.clear();
|
||||
assert(weak_refs.empty());
|
||||
if (!weak_refs.empty()) {
|
||||
lderr(cct) << "leaked refs:\n";
|
||||
dump_weak_refs(*_dout);
|
||||
*_dout << dendl;
|
||||
assert(weak_refs.empty());
|
||||
}
|
||||
}
|
||||
|
||||
void set_cct(CephContext *c) {
|
||||
cct = c;
|
||||
}
|
||||
|
||||
void dump_weak_refs(ostream& out) {
|
||||
for (typename map<K, WeakVPtr>::iterator p = weak_refs.begin();
|
||||
p != weak_refs.end();
|
||||
++p) {
|
||||
out << __func__ << " " << this << " weak_refs: "
|
||||
<< p->first << " = " << p->second.lock().get()
|
||||
<< " with " << p->second.use_count() << " refs"
|
||||
<< std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void clear(const K& key) {
|
||||
VPtr val; // release any ref we have after we drop the lock
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user