From: John Spray Date: Thu, 14 Aug 2014 22:59:16 +0000 (+0100) Subject: librbd: handle blacklisting during shutdown X-Git-Tag: v0.86~213^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=6f3bb55a3d52403c1910f576ed835aa73013ca50;p=ceph.git librbd: handle blacklisting during shutdown 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 --- diff --git a/src/librbd/ImageCtx.cc b/src/librbd/ImageCtx.cc index 06ae93b261de..77211d7c9eae 100644 --- a/src/librbd/ImageCtx.cc +++ b/src/librbd/ImageCtx.cc @@ -569,10 +569,15 @@ namespace librbd { 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: "