mirror of
https://github.com/ceph/ceph
synced 2025-01-29 14:34:40 +00:00
Merge pull request #52524 from dparmar18/wip-62072
tools/cephfs_mirror: only perform actions if init succeed Reviewed-by: Rishabh Dave <ridave@redhat.com> Reviewed-by: Venky Shankar <vshankar@redhat.com>
This commit is contained in:
commit
9fedc1e062
@ -318,19 +318,24 @@ void Mirror::handle_enable_mirroring(const Filesystem &filesystem,
|
||||
|
||||
std::scoped_lock locker(m_lock);
|
||||
auto &mirror_action = m_mirror_actions.at(filesystem);
|
||||
ceph_assert(mirror_action.action_in_progress);
|
||||
|
||||
mirror_action.action_in_progress = false;
|
||||
m_cond.notify_all();
|
||||
if (r < 0) {
|
||||
derr << ": failed to initialize FSMirror for filesystem=" << filesystem
|
||||
<< ": " << cpp_strerror(r) << dendl;
|
||||
// since init failed, don't assert, just unset it directly
|
||||
mirror_action.action_in_progress = false;
|
||||
m_cond.notify_all();
|
||||
m_service_daemon->add_or_update_fs_attribute(filesystem.fscid,
|
||||
SERVICE_DAEMON_MIRROR_ENABLE_FAILED_KEY,
|
||||
true);
|
||||
return;
|
||||
}
|
||||
|
||||
ceph_assert(mirror_action.action_in_progress);
|
||||
|
||||
mirror_action.action_in_progress = false;
|
||||
m_cond.notify_all();
|
||||
|
||||
for (auto &peer : peers) {
|
||||
mirror_action.fs_mirror->add_peer(peer);
|
||||
}
|
||||
@ -343,19 +348,24 @@ void Mirror::handle_enable_mirroring(const Filesystem &filesystem, int r) {
|
||||
|
||||
std::scoped_lock locker(m_lock);
|
||||
auto &mirror_action = m_mirror_actions.at(filesystem);
|
||||
ceph_assert(mirror_action.action_in_progress);
|
||||
|
||||
mirror_action.action_in_progress = false;
|
||||
m_cond.notify_all();
|
||||
|
||||
if (r < 0) {
|
||||
derr << ": failed to initialize FSMirror for filesystem=" << filesystem
|
||||
<< ": " << cpp_strerror(r) << dendl;
|
||||
// since init failed, don't assert, just unset it directly
|
||||
mirror_action.action_in_progress = false;
|
||||
m_cond.notify_all();
|
||||
m_service_daemon->add_or_update_fs_attribute(filesystem.fscid,
|
||||
SERVICE_DAEMON_MIRROR_ENABLE_FAILED_KEY,
|
||||
true);
|
||||
return;
|
||||
}
|
||||
|
||||
ceph_assert(mirror_action.action_in_progress);
|
||||
|
||||
mirror_action.action_in_progress = false;
|
||||
m_cond.notify_all();
|
||||
|
||||
dout(10) << ": Initialized FSMirror for filesystem=" << filesystem << dendl;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user