Merge pull request #41801 from liu-chunmei/seastore-fix-get-retired-extent

crimson/seastore: fix cache::get_extent got retired extent

Reviewed-by: Samuel Just <sjust@redhat.com>
This commit is contained in:
Samuel Just 2021-06-15 07:01:07 -07:00 committed by GitHub
commit c323e59930
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 5 additions and 15 deletions

View File

@ -123,7 +123,7 @@ void Cache::retire_extent(CachedExtentRef ref)
remove_from_dirty(ref);
ref->dirty_from_or_retired_at = JOURNAL_SEQ_MAX;
retired_extent_gate.add_extent(*ref);
ref->state = CachedExtent::extent_state_t::RETIRED;
ref->state = CachedExtent::extent_state_t::INVALID;
}
void Cache::replace_extent(CachedExtentRef next, CachedExtentRef prev)

View File

@ -185,8 +185,6 @@ public:
return get_extent_ret<T>(
get_extent_ertr::ready_future_marker{},
std::move(ret));
} else if (ret->is_retired()) {
ceph_abort_msg("impossible retired extent");
} else {
return crimson::ct_error::eagain::make();
}

View File

@ -46,8 +46,6 @@ std::ostream &operator<<(std::ostream &out, CachedExtent::extent_state_t state)
return out << "CLEAN";
case CachedExtent::extent_state_t::DIRTY:
return out << "DIRTY";
case CachedExtent::extent_state_t::RETIRED:
return out << "RETIRED";
case CachedExtent::extent_state_t::INVALID:
return out << "INVALID";
default:

View File

@ -48,7 +48,6 @@ class CachedExtent : public boost::intrusive_ref_counter<
// during write, contents match disk, version == 0
DIRTY, // Same as CLEAN, but contents do not match disk,
// version > 0
RETIRED, // In ExtentIndex while in retired_extent_gate
INVALID // Part of no ExtentIndex set
} state = extent_state_t::INVALID;
friend std::ostream &operator<<(std::ostream &, extent_state_t);
@ -225,12 +224,7 @@ public:
/// Returns true if extent has not been superceded or retired
bool is_valid() const {
return state != extent_state_t::INVALID && state != extent_state_t::RETIRED;
}
/// True iff extent is in state RETIRED
bool is_retired() const {
return state == extent_state_t::RETIRED;
return state != extent_state_t::INVALID;
}
/// Returns true if extent or prior_instance has been invalidated
@ -246,7 +240,7 @@ public:
/// Return journal location of oldest relevant delta, only valid while RETIRED
auto get_retired_at() const {
ceph_assert(is_retired());
ceph_assert(!is_valid());
return dirty_from_or_retired_at;
}
@ -376,7 +370,7 @@ protected:
poffset(other.poffset) {}
struct retired_placeholder_t{};
CachedExtent(retired_placeholder_t) : state(extent_state_t::RETIRED) {}
CachedExtent(retired_placeholder_t) : state(extent_state_t::INVALID) {}
friend class Cache;
template <typename T, typename... Args>

View File

@ -339,7 +339,6 @@ class NodeExtentAccessorT {
bool is_retired() const {
if (extent) {
assert(!extent->is_retired());
return false;
} else {
return true;

View File

@ -134,6 +134,7 @@ struct object_data_handler_test_t:
seastar::future<> set_up_fut() final {
onode = new TestOnode{};
known_contents = buffer::create(4<<20 /* 4MB */);
memset(known_contents.c_str(), 0, known_contents.length());
size = 0;
return tm_setup();
}