]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Rename REMOVE_OBJ to INVALIDATE_OBJ
authorAdam C. Emerson <aemerson@redhat.com>
Wed, 14 Jul 2021 14:57:02 +0000 (10:57 -0400)
committerAdam C. Emerson <aemerson@redhat.com>
Wed, 14 Jul 2021 16:44:23 +0000 (12:44 -0400)
Also rename ObjectCache::remove to ObjectCache::invalidate_remove

Since we're depending on these message types/functions having
invalidate semantics but NOT caching a negative result, rename and
leave a comment for clarity.

Fixes: https://tracker.ceph.com/issues/51674
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_cache.cc
src/rgw/rgw_cache.h
src/rgw/services/svc_sys_obj_cache.cc

index e82c142eb024042ba06e742a3a408582910fe6a8..b46c26d5b9997e99e468f7bb4c3b8447ad3cc4e2 100644 (file)
@@ -212,7 +212,9 @@ void ObjectCache::put(const DoutPrefixProvider *dpp, const string& name, ObjectC
     target.version = info.version;
 }
 
-bool ObjectCache::remove(const DoutPrefixProvider *dpp, const string& name)
+// WARNING: This function /must not/ be modified to cache a
+// negative lookup. It must only invalidate.
+bool ObjectCache::invalidate_remove(const DoutPrefixProvider *dpp, const string& name)
 {
   std::unique_lock l{lock};
 
index c00d1a36c8f51c4a01a93bdf2c032a48a33f2c04..08eaffca226540316846f26c9255565678e18eae 100644 (file)
@@ -17,7 +17,7 @@
 
 enum {
   UPDATE_OBJ,
-  REMOVE_OBJ,
+  INVALIDATE_OBJ,
 };
 
 #define CACHE_FLAG_DATA           0x01
@@ -204,7 +204,7 @@ public:
   }
 
   void put(const DoutPrefixProvider *dpp, const std::string& name, ObjectCacheInfo& bl, rgw_cache_entry_info *cache_info);
-  bool remove(const DoutPrefixProvider *dpp, const std::string& name);
+  bool invalidate_remove(const DoutPrefixProvider *dpp, const std::string& name);
   void set_ctx(CephContext *_cct) {
     cct = _cct;
     lru_window = cct->_conf->rgw_cache_lru_size / 2;
index a914067ca75653a04a15b128cace7aef01096a33..5690f8d14c5beac331ece7b2eaf8fa8520b09229 100644 (file)
@@ -94,10 +94,10 @@ int RGWSI_SysObj_Cache::remove(const DoutPrefixProvider *dpp,
   normalize_pool_and_obj(obj.pool, obj.oid, pool, oid);
 
   string name = normal_name(pool, oid);
-  cache.remove(dpp, name);
+  cache.invalidate_remove(dpp, name);
 
   ObjectCacheInfo info;
-  int r = distribute_cache(dpp, name, obj, info, REMOVE_OBJ, y);
+  int r = distribute_cache(dpp, name, obj, info, INVALIDATE_OBJ, y);
   if (r < 0) {
     ldpp_dout(dpp, 0) << "ERROR: " << __func__ << "(): failed to distribute cache: r=" << r << dendl;
   }
@@ -270,7 +270,7 @@ int RGWSI_SysObj_Cache::set_attrs(const DoutPrefixProvider *dpp,
     if (r < 0)
       ldpp_dout(dpp, 0) << "ERROR: failed to distribute cache for " << obj << dendl;
   } else {
-    cache.remove(dpp, name);
+    cache.invalidate_remove(dpp, name);
   }
 
   return ret;
@@ -314,7 +314,7 @@ int RGWSI_SysObj_Cache::write(const DoutPrefixProvider *dpp,
     if (r < 0)
       ldpp_dout(dpp, 0) << "ERROR: failed to distribute cache for " << obj << dendl;
   } else {
-    cache.remove(dpp, name);
+    cache.invalidate_remove(dpp, name);
   }
 
   return ret;
@@ -349,7 +349,7 @@ int RGWSI_SysObj_Cache::write_data(const DoutPrefixProvider *dpp,
     if (r < 0)
       ldpp_dout(dpp, 0) << "ERROR: failed to distribute cache for " << obj << dendl;
   } else {
-    cache.remove(dpp, name);
+    cache.invalidate_remove(dpp, name);
   }
 
   return ret;
@@ -461,8 +461,8 @@ int RGWSI_SysObj_Cache::watch_cb(const DoutPrefixProvider *dpp,
   case UPDATE_OBJ:
     cache.put(dpp, name, info.obj_info, NULL);
     break;
-  case REMOVE_OBJ:
-    cache.remove(dpp, name);
+  case INVALIDATE_OBJ:
+    cache.invalidate_remove(dpp, name);
     break;
   default:
     ldpp_dout(dpp, 0) << "WARNING: got unknown notification op: " << info.op << dendl;
@@ -633,7 +633,7 @@ int RGWSI_SysObj_Cache::ASocketHandler::call_inspect(const std::string& target,
 
 int RGWSI_SysObj_Cache::ASocketHandler::call_erase(const std::string& target)
 {
-  return svc->cache.remove(dpp, target);
+  return svc->cache.invalidate_remove(dpp, target);
 }
 
 int RGWSI_SysObj_Cache::ASocketHandler::call_zap()