From df428abd8f5313166b061bd82a9e9e390bdd2493 Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Wed, 15 Sep 2021 21:23:29 +0000 Subject: [PATCH] crimson/os/seastore/cache: Cache::get_root check for invalid 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 --- src/crimson/os/seastore/cache.cc | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/crimson/os/seastore/cache.cc b/src/crimson/os/seastore/cache.cc index 500c327ee1746..f0a598f5f88bb 100644 --- a/src/crimson/os/seastore/cache.cc +++ b/src/crimson/os/seastore/cache.cc @@ -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( - ret); + if (!ret->is_valid()) { + DEBUGT("root became invalid: {}", t, *ret); + mark_transaction_conflicted(t, *ret); + return get_root_iertr::make_ready_future(); + } else { + t.root = ret; + t.add_to_read_set(ret); + return get_root_iertr::make_ready_future( + ret); + } }); } } -- 2.39.5