]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
librbd/migration/HttpClient: avoid hitting an assert in advance_state()
authorIlya Dryomov <idryomov@gmail.com>
Wed, 11 Dec 2024 15:25:13 +0000 (16:25 +0100)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 16 Dec 2024 08:49:54 +0000 (09:49 +0100)
commit64d0276750fc6f3c75cde0b49e6004294c2436bb
treee8b3a16f6d4376163d6b47c42d90176607a51e7e
parent7e1856f18ca53ec253e247794ac9df742f60eab9
librbd/migration/HttpClient: avoid hitting an assert in advance_state()

If the shutdown gets delayed until the state transition from
STATE_RESET_CONNECTING completes and the reconnect is successful
(i.e. next_state is STATE_READY), we eventually hit "unexpected
state transition" assert in advance_state().  The reason is that
advance_state() would update m_state and call disconnect() under
STATE_READY instead of STATE_SHUTTING_DOWN.  After the disconnect
maybe_finalize_shutdown() would enter advance_state() again with
STATE_SHUTDOWN as next_state, but the transition to that from
STATE_READY is invalid.

Plug this by not transitioning to next_state if current_state is
STATE_SHUTTING_DOWN.

Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
(cherry picked from commit 1046d610e3d6852258e6c4bf0355d0d13fb197b4)
src/librbd/migration/HttpClient.cc