]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
os/ObjectStore: properly clear object map when replaying OP_REMOVE
authorYan, Zheng <zyan@redhat.com>
Mon, 10 Oct 2016 10:39:30 +0000 (18:39 +0800)
committerYan, Zheng <zyan@redhat.com>
Thu, 13 Oct 2016 08:26:09 +0000 (16:26 +0800)
To remove an object, filestore needs to unlink corresponding object
file from filesystem and removes corresponding object keys from
DBObjectMap. When replaying OP_REMOVE operation, it's possible the
operation has completed partially, object file has been deleted, but
object keys in DBObjectMap hasn't.

The fix is force clear object keys if object file does not exists

Fixes: http://tracker.ceph.com/issues/17177
Signed-off-by: Yan, Zheng <zyan@redhat.com>
src/os/filestore/FileStore.cc

index ff928314861995d4c13eadf87a2c6ec2be8d5c6e..7029571212d4d95e9f47e2106d1458f38a4a06c4 100644 (file)
@@ -472,13 +472,7 @@ int FileStore::lfn_unlink(const coll_t& cid, const ghobject_t& o,
     }
 
     if (!force_clear_omap) {
-      if (hardlink == 0) {
-          if (!m_disable_wbthrottle) {
-           wbthrottle.clear_object(o); // should be only non-cache ref
-          }
-         fdcache.clear(o);
-         return 0;
-      } else if (hardlink == 1) {
+      if (hardlink == 0 || hardlink == 1) {
          force_clear_omap = true;
       }
     }
@@ -505,6 +499,12 @@ int FileStore::lfn_unlink(const coll_t& cid, const ghobject_t& o,
       if (!backend->can_checkpoint())
        object_map->sync(&o, &spos);
     }
+    if (hardlink == 0) {
+      if (!m_disable_wbthrottle) {
+       wbthrottle.clear_object(o); // should be only non-cache ref
+      }
+      return 0;
+    }
   }
   r = index->unlink(o);
   if (r < 0) {