]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/cache: Cache::get_root check for invalid 43178/head
authorSamuel Just <sjust@redhat.com>
Wed, 15 Sep 2021 21:23:29 +0000 (21:23 +0000)
committerSamuel Just <sjust@redhat.com>
Thu, 16 Sep 2021 02:33:37 +0000 (02:33 +0000)
As with Cache::get_extent, we need to check that the ref
is still valid after wait_io since it's not in the
read set yet.

Fixes: https://tracker.ceph.com/issues/52623
Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/cache.cc

index 500c327ee17466b52e267d88365ae8b9973c5b66..f0a598f5f88bbdd73f6e4ebe23fe74ce38680b56 100644 (file)
@@ -1171,12 +1171,18 @@ Cache::get_root_ret Cache::get_root(Transaction &t)
   } else {
     auto ret = root;
     DEBUGT("waiting root {}", t, *ret);
-    return ret->wait_io().then([FNAME, ret, &t] {
+    return ret->wait_io().then([this, FNAME, ret, &t] {
       DEBUGT("got root read {}", t, *ret);
-      t.root = ret;
-      t.add_to_read_set(ret);
-      return get_root_iertr::make_ready_future<RootBlockRef>(
-       ret);
+      if (!ret->is_valid()) {
+       DEBUGT("root became invalid: {}", t, *ret);
+       mark_transaction_conflicted(t, *ret);
+       return get_root_iertr::make_ready_future<RootBlockRef>();
+      } else {
+       t.root = ret;
+       t.add_to_read_set(ret);
+       return get_root_iertr::make_ready_future<RootBlockRef>(
+         ret);
+      }
     });
   }
 }