From 9aec60cff2dade5f9a50e78dd4adadc6c45a3a50 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Fri, 29 Aug 2025 18:00:53 +0000 Subject: [PATCH] mds: use subvolume-id in labeled perf counters key instead of subvolume path The path being built is by calling MDCache::get_inode() without holding mds_lock making it unsafe. Until, that is fixed, use a stringified version of the subvolume-id as path. Signed-off-by: Venky Shankar --- src/mds/MetricsHandler.cc | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/mds/MetricsHandler.cc b/src/mds/MetricsHandler.cc index a98d8e61409..2e70a9e4265 100644 --- a/src/mds/MetricsHandler.cc +++ b/src/mds/MetricsHandler.cc @@ -323,21 +323,20 @@ void MetricsHandler::handle_payload(Session *session, const WriteIoSizesPayload void MetricsHandler::handle_payload(Session *session, const SubvolumeMetricsPayload &payload) { dout(20) << ": type=" << payload.get_type() << ", session=" << session - << " , subv_metrics count=" << payload.subvolume_metrics.size() << dendl; - - auto it = client_metrics_map.find(session->info.inst); - if (it == client_metrics_map.end()) { - return; - } + << " , subv_metrics count=" << payload.subvolume_metrics.size() << dendl; // on each mds we accumulate aggregated metrics from each client per each subvolume // to be later send to the metrics handler for aggregation for (auto const& metric : payload.subvolume_metrics) { + // FIXME: this is unsafe to call without mds_lock held - use subvolume-id + // as the path string (for now). + /* std::string path = mds->get_path(metric.subvolume_id); if (path.empty()) { dout(10) << " path not found for " << metric.subvolume_id << dendl; continue; - } + } */ + std::string path = stringify(metric.subvolume_id); auto& metrics_vec = subvolume_metrics_map[path]; dout(20) << " accumulating subv_metric " << metric << dendl; metrics_vec.push_back(std::move(metric)); @@ -448,7 +447,8 @@ void MetricsHandler::update_rank0() { ++last_updated_seq; } - dout(20) << "sending " << metrics_message.subvolume_metrics.size() << " subv_metrics to aggregator" << dendl; + dout(20) << ": sending " << metrics_message.subvolume_metrics.size() << " subv_metrics to aggregator" + << dendl; mds->send_message_mds(make_message(std::move(metrics_message)), *addr_rank0); } -- 2.39.5