diff options
author | Sage Weil <sage@inktank.com> | 2012-11-29 16:45:52 -0800 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-11-29 16:47:26 -0800 |
commit | abd9e36c5dbbc1ca16fd1e6b2fd79306da2dde00 (patch) | |
tree | 9cd58b17898bd7effb40ea846c1569f127bc8cbd | |
parent | bea3ecf0746e57f6ac4fb32ef3f13bd328447992 (diff) | |
download | ceph-abd9e36c5dbbc1ca16fd1e6b2fd79306da2dde00.tar.gz |
client: only dump cache on umount if we time out
We don't want to dump the cache every time an item is trimmed and the
mount_cond gets signaled; this can make umount crazy-slow when logging is
turned up.
Instead, only dump if we wait 5 seconds without making any progress on
shrinking the cache.
Signed-off-by: Sage Weil <sage@inktank.com>
-rw-r--r-- | src/client/Client.cc | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/client/Client.cc b/src/client/Client.cc index 1c881828540..84438e79acc 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -1692,14 +1692,14 @@ bool Client::ms_dispatch(Message *m) if (unmounting) { ldout(cct, 10) << "unmounting: trim pass, size was " << lru.lru_get_size() << "+" << inode_map.size() << dendl; + long unsigned size = lru.lru_get_size() + inode_map.size(); trim_cache(); - if (lru.lru_get_size() == 0 && inode_map.empty()) { - ldout(cct, 10) << "unmounting: trim pass, cache now empty, waking unmount()" << dendl; + if (size < lru.lru_get_size() + inode_map.size()) { + ldout(cct, 10) << "unmounting: trim pass, cache shrank, poking unmount()" << dendl; mount_cond.Signal(); } else { ldout(cct, 10) << "unmounting: trim pass, size still " << lru.lru_get_size() << "+" << inode_map.size() << dendl; - dump_cache(NULL); } } @@ -3591,8 +3591,11 @@ void Client::unmount() << "+" << inode_map.size() << " items" << ", waiting (for caps to release?)" << dendl; - dump_cache(NULL); - mount_cond.Wait(client_lock); + utime_t until = ceph_clock_now(cct) + utime_t(5, 0); + int r = mount_cond.WaitUntil(client_lock, until); + if (r == ETIMEDOUT) { + dump_cache(NULL); + } } assert(lru.lru_get_size() == 0); assert(inode_map.empty()); |