From: NitzanMordhai Date: Thu, 28 Jul 2022 12:10:15 +0000 (+0000) Subject: osd/PrimaryLogPG: get attribute for ec return wrong value for non-exist object X-Git-Tag: v18.1.0~468^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f060683a2d29fa4c7f20c6f5e20cae9ac23d4481;p=ceph.git osd/PrimaryLogPG: get attribute for ec return wrong value for non-exist object In case of copy object when the target copy is not exist with erasure code pool getattr_maybe_cache will return ENODATA that will cause ref_count to wildcard tag that can affect pglog to grow quickly with refcounts for each copy Fixes: https://tracker.ceph.com/issues/56707 Signed-off-by: Nitzan Mordechai --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index 47265c169334..4efab2062121 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -15751,7 +15751,11 @@ int PrimaryLogPG::getattr_maybe_cache( *val = i->second; return 0; } else { - return -ENODATA; + if (obc->obs.exists) { + return -ENODATA; + } else { + return -ENOENT; + } } } return pgbackend->objects_get_attr(obc->obs.oi.soid, key, val); diff --git a/src/osd/PrimaryLogPG.h b/src/osd/PrimaryLogPG.h index 28e6bdf329bc..808ab411440a 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1915,6 +1915,13 @@ public: ObjectContextRef obc, PGTransaction *t, const std::string &key); + /** + * getattr_maybe_cache + * + * Populates val (if non-null) with the value of the attr with the specified key. + * Returns -ENOENT if object does not exist, -ENODATA if the object exists, + * but the specified key does not. + */ int getattr_maybe_cache( ObjectContextRef obc, const std::string &key,