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 <sjust@redhat.com>
This commit is contained in:
Samuel Just 2021-09-15 21:23:29 +00:00
parent 11c8e258e7
commit df428abd8f

View 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);
}
});
}
}