From 6f3bb55a3d52403c1910f576ed835aa73013ca50 Mon Sep 17 00:00:00 2001 From: John Spray Date: Thu, 14 Aug 2014 23:59:16 +0100 Subject: [PATCH] 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 --- src/librbd/ImageCtx.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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: " -- 2.47.3