Skip to content

Commit

Permalink
rgw: RGWSI_SysObj_Cache::remove() invalidates after successful delete
Browse files Browse the repository at this point in the history
invalidating the cache before the librados delete means that a racing call
to `RGWSI_SysObj_Cache::read()` may succeed and repopulate the cache. in
that case, subsequent reads will continue to return cached data even after
the librados delete succeeds

Fixes: https://tracker.ceph.com/issues/64480

Signed-off-by: Casey Bodley <cbodley@redhat.com>
  • Loading branch information
cbodley committed Feb 18, 2024
1 parent 34933f5 commit 0eebbc3
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/rgw/services/svc_sys_obj_cache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ int RGWSI_SysObj_Cache::remove(const DoutPrefixProvider *dpp,
optional_yield y)

{
int r = RGWSI_SysObj_Core::remove(dpp, objv_tracker, obj, y);
if (r < 0) {
return r;
}

rgw_pool pool;
string oid;
normalize_pool_and_obj(obj.pool, obj.oid, pool, oid);
Expand All @@ -97,12 +102,12 @@ int RGWSI_SysObj_Cache::remove(const DoutPrefixProvider *dpp,
cache.invalidate_remove(dpp, name);

ObjectCacheInfo info;
int r = distribute_cache(dpp, name, obj, info, INVALIDATE_OBJ, y);
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;
}
} // not fatal

return RGWSI_SysObj_Core::remove(dpp, objv_tracker, obj, y);
return 0;
}

int RGWSI_SysObj_Cache::read(const DoutPrefixProvider *dpp,
Expand Down

0 comments on commit 0eebbc3

Please sign in to comment.