From: Yin Congmin Date: Wed, 1 Sep 2021 15:56:18 +0000 (+0000) Subject: librbd/cache/pwl: don't clear next_sync_point_entry prematurely X-Git-Tag: v16.2.7~50^2~21 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=be48a769e41804958ebaa0717c9a226ba827a98f;p=ceph.git librbd/cache/pwl: don't clear next_sync_point_entry prematurely In SyncPointLogOperation::clear_earlier_sync_point(), sync_point->log_entry->next_sync_point_entry was prematurely set to nullptr in clear_earlier_sync_point(). It is in write op stage, but next_sync_point_entry is used in writeback stage in handle_flushed_sync_point(). handle_flushed_sync_point() may pass a nullptr cause assert in m_work_queue.The solution is to move the statement that set next_sync_point_entry to nullptr after it is used. Fixes: https://tracker.ceph.com/issues/52465 Signed-off-by: Yin Congmin (cherry picked from commit a1a20041d57c9a90bc0a60d86469445ba8efb5ea) --- diff --git a/src/librbd/cache/pwl/AbstractWriteLog.cc b/src/librbd/cache/pwl/AbstractWriteLog.cc index 40b7fcb7daf3..89527c3f0a46 100644 --- a/src/librbd/cache/pwl/AbstractWriteLog.cc +++ b/src/librbd/cache/pwl/AbstractWriteLog.cc @@ -1756,11 +1756,11 @@ bool AbstractWriteLog::handle_flushed_sync_point(std::shared_ptrnext_sync_point_entry)](int r) { bool handled_by_next; { std::lock_guard locker(m_lock); - handled_by_next = handle_flushed_sync_point(log_entry->next_sync_point_entry); + handled_by_next = handle_flushed_sync_point(std::move(next)); } if (!handled_by_next) { persist_last_flushed_sync_gen(); diff --git a/src/librbd/cache/pwl/LogOperation.cc b/src/librbd/cache/pwl/LogOperation.cc index 54da5a2e002d..4fc13a91a23f 100644 --- a/src/librbd/cache/pwl/LogOperation.cc +++ b/src/librbd/cache/pwl/LogOperation.cc @@ -73,7 +73,6 @@ void SyncPointLogOperation::clear_earlier_sync_point() { ceph_assert(sync_point->later_sync_point->earlier_sync_point == sync_point); sync_point->later_sync_point->earlier_sync_point = nullptr; sync_point->later_sync_point = nullptr; - sync_point->log_entry->next_sync_point_entry = nullptr; } std::vector SyncPointLogOperation::swap_on_sync_point_persisted() {