This was failing the test_lock_fence.sh test due to
a crash during shutdown when the rbd client was blacklisted.
We should fix this more generally in ObjectCacher at some
point, but for the moment handle it explicitly in librbd.
Fixes: #9105
Signed-off-by: John Spray <john.spray@redhat.com>
object_cacher->release_set(object_set);
cache_lock.Unlock();
int r = flush_cache();
- if (r)
+ if (r == -EBLACKLISTED) {
+ Mutex::Locker l(cache_lock);
+ lderr(cct) << "Blacklisted during flush! Purging cache..." << dendl;
+ object_cacher->purge_set(object_set);
+ } else if (r) {
lderr(cct) << "flush_cache returned " << r << dendl;
+ }
cache_lock.Lock();
- bool unclean = object_cacher->release_set(object_set);
+ loff_t unclean = object_cacher->release_set(object_set);
cache_lock.Unlock();
if (unclean) {
lderr(cct) << "could not release all objects from cache: "