]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osdc/ObjectCacher: check lru_is_expireable() in can_close()
authorSage Weil <sage@inktank.com>
Tue, 23 Oct 2012 16:18:04 +0000 (09:18 -0700)
committerSage Weil <sage@inktank.com>
Fri, 26 Oct 2012 18:31:44 +0000 (11:31 -0700)
We assert that if can_close(), the Object isn't pinned in the LRU.  This
assumes we did yur get/put refcounting properly, such that the pins are
at least as restrictive as can_close().

Signed-off-by: Sage Weil <sage@inktank.com>
src/osdc/ObjectCacher.h

index 09fb17cb42edbdaa2ba0fbbb1e0bbed014826ae6..ac17c4f8daca8d3c3ce82e03262f0b58a0b74d25 100644 (file)
@@ -225,10 +225,14 @@ class ObjectCacher {
     void set_object_locator(object_locator_t& l) { oloc = l; }
 
     bool can_close() {
-      return data.empty() && lock_state == LOCK_NONE &&
-        waitfor_commit.empty() &&
-        waitfor_rd.empty() && waitfor_wr.empty() &&
-       dirty_or_tx == 0;
+      if (data.empty() && lock_state == LOCK_NONE &&
+         waitfor_commit.empty() &&
+         waitfor_rd.empty() && waitfor_wr.empty() &&
+         dirty_or_tx == 0) {
+       assert(lru_is_expireable());
+       return true;
+      }
+      return false;
     }
 
     /**