From: Yan, Zheng Date: Mon, 10 Oct 2016 10:39:30 +0000 (+0800) Subject: os/ObjectStore: properly clear object map when replaying OP_REMOVE X-Git-Tag: v11.1.0~527^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3223378194ad59850177cb87754cb1ada2e5e5f1;p=ceph.git os/ObjectStore: properly clear object map when replaying OP_REMOVE 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 --- diff --git a/src/os/filestore/FileStore.cc b/src/os/filestore/FileStore.cc index ff9283148619..7029571212d4 100644 --- a/src/os/filestore/FileStore.cc +++ b/src/os/filestore/FileStore.cc @@ -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) {