From 88bc6ca0f2c4a723000aec325e852073c7cd5808 Mon Sep 17 00:00:00 2001 From: Yuan Zhou Date: Mon, 25 Feb 2019 11:31:46 +0800 Subject: [PATCH] tools: return real cache status on lookup in immutable obj cache Signed-off-by: Yuan Zhou --- src/tools/immutable_object_cache/CacheController.cc | 2 +- src/tools/immutable_object_cache/ObjectCacheStore.cc | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/src/tools/immutable_object_cache/CacheController.cc b/src/tools/immutable_object_cache/CacheController.cc index dd4ef3f3ed1..213b2d36b50 100644 --- a/src/tools/immutable_object_cache/CacheController.cc +++ b/src/tools/immutable_object_cache/CacheController.cc @@ -103,7 +103,7 @@ void CacheController::handle_request(uint64_t session_id, ObjectCacheRequest* re data->m_snap_id, data->m_oid, cache_path); - if (ret < 0) { + if (ret != OBJ_CACHE_PROMOTED) { ObjectCacheReadRadosData reply_data; reply_data.type = RBDSC_READ_RADOS; reply_data.seq = req->seq; diff --git a/src/tools/immutable_object_cache/ObjectCacheStore.cc b/src/tools/immutable_object_cache/ObjectCacheStore.cc index b1a4b37291b..cafe4a731e8 100644 --- a/src/tools/immutable_object_cache/ObjectCacheStore.cc +++ b/src/tools/immutable_object_cache/ObjectCacheStore.cc @@ -192,14 +192,13 @@ int ObjectCacheStore::lookup_object(std::string pool_nspace, if (pret < 0) { lderr(m_cct) << "fail to start promote" << dendl; } - return pret; + return ret; } case OBJ_CACHE_PROMOTED: - target_cache_file_path = std::move( - get_cache_file_path(cache_file_name)); - return 0; + target_cache_file_path = get_cache_file_path(cache_file_name); + return ret; case OBJ_CACHE_SKIP: - return pret; + return ret; default: lderr(m_cct) << "unrecognized object cache status" << dendl; ceph_assert(0); -- 2.39.5