Skip to content

Commit a9cb3a5

Browse files
committed
mds/quiesce: disable quiesce root debug parameters by default
Fixes: https://tracker.ceph.com/issues/66225 Signed-off-by: Leonid Usov <[email protected]>
1 parent 9a4c585 commit a9cb3a5

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

src/mds/MDSRankQuiesce.cc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,11 @@ void MDSRank::quiesce_agent_setup() {
432432

433433
using RequestHandle = QuiesceInterface::RequestHandle;
434434
using QuiescingRoot = std::pair<RequestHandle, Context*>;
435-
auto dummy_requests = std::make_shared<std::unordered_map<QuiesceRoot, QuiescingRoot>>();
435+
436+
std::shared_ptr<std::unordered_map<QuiesceRoot, QuiescingRoot>> dummy_requests;
437+
#ifdef QUIESCE_ROOT_DEBUG_PARAMS
438+
dummy_requests = std::make_shared<std::unordered_map<QuiesceRoot, QuiescingRoot>>();
439+
#endif
436440

437441
QuiesceAgent::ControlInterface ci;
438442

@@ -447,7 +451,9 @@ void MDSRank::quiesce_agent_setup() {
447451

448452
dout(10) << "submit_request: " << uri << dendl;
449453

454+
bool the_real_deal = true;
450455
std::chrono::milliseconds quiesce_delay_ms = 0ms;
456+
#ifdef QUIESCE_ROOT_DEBUG_PARAMS
451457
if (auto pit = uri->params().find("delayms"); pit != uri->params().end()) {
452458
try {
453459
quiesce_delay_ms = std::chrono::milliseconds((*pit).has_value ? std::stoul((*pit).value) : 1000);
@@ -496,12 +502,14 @@ void MDSRank::quiesce_agent_setup() {
496502
return std::nullopt;
497503
}
498504

505+
the_real_deal = !debug_quiesce_after && !debug_fail_after && !debug_rank;
506+
#endif
507+
499508
auto path = uri->path();
500509

501510
std::lock_guard l(mds_lock);
502511

503-
if (!debug_quiesce_after && !debug_fail_after && !debug_rank) {
504-
// the real deal!
512+
if (the_real_deal) {
505513
if (mdsmap->is_degraded()) {
506514
dout(3) << "DEGRADED: refusing to quiesce" << dendl;
507515
c->complete(EPERM);
@@ -511,6 +519,9 @@ void MDSRank::quiesce_agent_setup() {
511519
auto mdr = mdcache->quiesce_path(filepath(path), qc, nullptr, quiesce_delay_ms);
512520
return mdr ? mdr->reqid : std::optional<RequestHandle>();
513521
} else {
522+
#ifndef QUIESCE_ROOT_DEBUG_PARAMS
523+
ceph_abort("quiesce debug parameters are disabled");
524+
#else
514525
/* we use this branch to allow for quiesce emulation for testing purposes */
515526
// always create a new request id
516527
auto req_id = metareqid_t(entity_name_t::MDS(whoami), issue_tid());
@@ -562,6 +573,7 @@ void MDSRank::quiesce_agent_setup() {
562573
timer.add_event_after(delay, quiesce_task);
563574
}
564575
return it->second.first;
576+
#endif // QUIESCE_ROOT_DEBUG_PARAMS
565577
}
566578
};
567579

@@ -575,6 +587,7 @@ void MDSRank::quiesce_agent_setup() {
575587
return 0;
576588
}
577589

590+
#ifdef QUIESCE_ROOT_DEBUG_PARAMS
578591
// if we get here then it could be a test (dummy) quiesce
579592
auto it = std::ranges::find(*dummy_requests, h, [](auto x) { return x.second.first; });
580593
if (it != dummy_requests->end()) {
@@ -585,6 +598,7 @@ void MDSRank::quiesce_agent_setup() {
585598
dummy_requests->erase(it);
586599
return 0;
587600
}
601+
#endif // QUIESCE_ROOT_DEBUG_PARAMS
588602

589603
// we must indicate that the handle wasn't found
590604
// so that the agent can properly report a missing

0 commit comments

Comments
 (0)