]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: handle blacklisting during shutdown
authorJohn Spray <john.spray@redhat.com>
Thu, 14 Aug 2014 22:59:16 +0000 (23:59 +0100)
committerJohn Spray <john.spray@redhat.com>
Mon, 25 Aug 2014 00:34:19 +0000 (01:34 +0100)
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>
src/librbd/ImageCtx.cc

index 06ae93b261def6f7671d3284575570d4979a4aaf..77211d7c9eaee85f1657ebcc87941cc944454d4d 100644 (file)
@@ -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: "