]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: get attribute for ec return wrong value for non-exist object 49937/head
authorNitzanMordhai <nmordech@redhat.com>
Thu, 28 Jul 2022 12:10:15 +0000 (12:10 +0000)
committerNitzanMordhai <nmordech@redhat.com>
Tue, 31 Jan 2023 05:38:55 +0000 (07:38 +0200)
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 <nmordec@redhat.com>
(cherry picked from commit f060683a2d29fa4c7f20c6f5e20cae9ac23d4481)

src/osd/PrimaryLogPG.cc
src/osd/PrimaryLogPG.h

index c1673bf700fde0698d96a3bf109f89dc3e4378c4..bc5b6186538b1f7d0998f7f767ec2a21c4d5a427 100644 (file)
@@ -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);
index 68cdec24e38ed780aa9d0b6453891289ae9fcbc9..2736f3de997eeb01ae938f2957ff09754d3b5f97 100644 (file)
@@ -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,