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: v16.2.13~64^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=8960b8530df5e0a8a39d8b226a11f3a4fa57c0ad;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 (cherry picked from commit f060683a2d29fa4c7f20c6f5e20cae9ac23d4481) --- diff --git a/src/osd/PrimaryLogPG.cc b/src/osd/PrimaryLogPG.cc index c1673bf700f..bc5b6186538 100644 --- a/src/osd/PrimaryLogPG.cc +++ b/src/osd/PrimaryLogPG.cc @@ -15421,7 +15421,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 68cdec24e38..2736f3de997 100644 --- a/src/osd/PrimaryLogPG.h +++ b/src/osd/PrimaryLogPG.h @@ -1922,6 +1922,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,