From b609375d2741f92c832d7d6879e648ee8f396e1d Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Mon, 13 Mar 2023 12:14:42 -0400 Subject: [PATCH] mon/MDSMonitor: do not propose on error in prepare_update There is nothing to propose in pending map when an error is encountered. Fixes: https://tracker.ceph.com/issues/58971 Signed-off-by: Patrick Donnelly (cherry picked from commit 22d0a7b13c4e6d8615e32a3447ea6ea8c0c82e5e) --- src/mon/MDSMonitor.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/mon/MDSMonitor.cc b/src/mon/MDSMonitor.cc index 638612df883..8a38ee4b1a6 100644 --- a/src/mon/MDSMonitor.cc +++ b/src/mon/MDSMonitor.cc @@ -554,7 +554,7 @@ bool MDSMonitor::prepare_update(MonOpRequestRef op) } catch (const bad_cmd_get& e) { bufferlist bl; mon.reply_command(op, -EINVAL, e.what(), bl, get_last_committed()); - return true; + return false; /* nothing to propose */ } case MSG_MDS_OFFLOAD_TARGETS: @@ -564,7 +564,7 @@ bool MDSMonitor::prepare_update(MonOpRequestRef op) ceph_abort(); } - return true; + return false; /* nothing to propose! */ } bool MDSMonitor::prepare_beacon(MonOpRequestRef op) @@ -864,6 +864,7 @@ null: bool MDSMonitor::prepare_offload_targets(MonOpRequestRef op) { auto &pending = get_pending_fsmap_writeable(); + bool propose = false; op->mark_mdsmon_event(__func__); auto m = op->get_req(); @@ -871,11 +872,12 @@ bool MDSMonitor::prepare_offload_targets(MonOpRequestRef op) if (pending.gid_has_rank(gid)) { dout(10) << "prepare_offload_targets " << gid << " " << m->targets << dendl; pending.update_export_targets(gid, m->targets); + propose = true; } else { dout(10) << "prepare_offload_targets " << gid << " not in map" << dendl; } mon.no_reply(op); - return true; + return propose; } bool MDSMonitor::should_propose(double& delay) @@ -1362,7 +1364,7 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op) if (!cmdmap_from_json(m->cmd, &cmdmap, ss)) { string rs = ss.str(); mon.reply_command(op, -EINVAL, rs, rdata, get_last_committed()); - return true; + return false; } string prefix; @@ -1372,7 +1374,7 @@ bool MDSMonitor::prepare_command(MonOpRequestRef op) MonSession *session = op->get_session(); if (!session) { mon.reply_command(op, -EACCES, "access denied", rdata, get_last_committed()); - return true; + return false; } auto &pending = get_pending_fsmap_writeable(); -- 2.39.5