25a23364 was supposed to fix this race, but it was not enough:
there was still a window between `prefetch` is queued for
execution in handle_cache_rebalanced and is actually executed,
during which shut_down can be called and completed.
Signed-off-by: Mykola Golub <mgolub@suse.com>
std::lock_guard locker{m_lock};
ceph_assert(m_state == STATE_INIT);
+ if (m_shut_down) {
+ return;
+ }
+
if (m_cache_manager_handler != nullptr && m_max_fetch_bytes == 0) {
m_state = STATE_WAITCACHE;
return;
if (m_state == STATE_WAITCACHE) {
m_state = STATE_INIT;
if (m_max_fetch_bytes >= min_bytes) {
+ m_async_op_tracker.start_op();
auto ctx = new FunctionContext(
[this](int r) {
prefetch();
+ m_async_op_tracker.finish_op();
});
m_journal_metadata->queue(ctx, 0);
return;