]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/osd: fix no ENOENT when removing already removed object 45302/head
authorRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 8 Mar 2022 17:25:29 +0000 (17:25 +0000)
committerRadoslaw Zarzynski <rzarzyns@redhat.com>
Tue, 8 Mar 2022 18:27:27 +0000 (18:27 +0000)
This patch deals with the following problem:

```
[rzarzynski@o06 build]$ RBD_FEATURES="21" ./bin/ceph_test_cls_rbd --gtest_filter=TestClsRbd.create
Running main() from gmock_main.cc
Note: Google Test filter = TestClsRbd.create
[==========] Running 1 test from 1 test suite.
[----------] Global test environment set-up.
[----------] 1 test from TestClsRbd
[ RUN      ] TestClsRbd.create
../src/test/cls_rbd/test_cls_rbd.cc:467: Failure
Expected equality of these values:
  -2
  ioctx.remove(oid)
    Which is: 0
[  FAILED  ] TestClsRbd.create (10 ms)
[----------] 1 test from TestClsRbd (10 ms total)

[----------] Global test environment tear-down
[==========] 1 test from 1 test suite ran. (2805 ms total)
[  PASSED  ] 0 tests.
[  FAILED  ] 1 test, listed below:
[  FAILED  ] TestClsRbd.create

 1 FAILED TEST
```

Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
src/crimson/osd/pg_backend.cc
src/crimson/osd/pg_backend.h

index e45b935bb323f2adf837f5091440839a9f4494f0..55f43f4c21e7b28a0f8f2da2b5569195acb59056 100644 (file)
@@ -758,10 +758,13 @@ PGBackend::remove(ObjectState& os, ceph::os::Transaction& txn)
   return seastar::now();
 }
 
-PGBackend::interruptible_future<>
+PGBackend::remove_iertr::future<>
 PGBackend::remove(ObjectState& os, ceph::os::Transaction& txn,
   object_stat_sum_t& delta_stats)
 {
+  if (!os.exists) {
+    return crimson::ct_error::enoent::make();
+  }
   // todo: snapset
   txn.remove(coll->get_cid(),
             ghobject_t{os.oi.soid, ghobject_t::NO_GEN, shard});
index 1d7e6219ee5bfb4612382e213c0941dec06796a1..ce551a55aae701a502144403b9c64c951108971b 100644 (file)
@@ -128,7 +128,13 @@ public:
     const OSDOp& osd_op,
     ceph::os::Transaction& trans,
     object_stat_sum_t& delta_stats);
-  interruptible_future<> remove(
+  using remove_ertr = crimson::errorator<
+    crimson::ct_error::enoent>;
+  using remove_iertr =
+    ::crimson::interruptible::interruptible_errorator<
+      ::crimson::osd::IOInterruptCondition,
+      remove_ertr>;
+  remove_iertr::future<> remove(
     ObjectState& os,
     ceph::os::Transaction& txn,
     object_stat_sum_t& delta_stats);