Skip to content

Commit 064df68

Browse files
athanatosMatan-B
authored andcommitted
crimson: fix DynamicPerfStats usage in ClientRequest
ClientRequest::get_connection() return l_conn, which will be null by the time PG::add_client_request_lat is called in ClientRequest::do_process. Modify get_connection() to return a Connection& from whichever of l_conn or r_conn isn't null. Signed-off-by: Samuel Just <[email protected]> (cherry picked from commit 794bb02)
1 parent 0b8306e commit 064df68

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/crimson/osd/osd_operations/client_request.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,13 @@ class ClientRequest final : public PhasedOperationT<ClientRequest> {
5454
static_assert(std::is_same_v<T, MOSDOp>);
5555
return m.get();
5656
}
57-
const crimson::net::ConnectionRef &get_connection() const {
58-
return l_conn;
57+
const crimson::net::Connection &get_connection() const {
58+
if (l_conn) {
59+
return *l_conn;
60+
} else {
61+
assert(r_conn);
62+
return *r_conn;
63+
}
5964
}
6065

6166
/**

src/osd/DynamicPerfStats.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ class DynamicPerfStats {
122122
break;
123123
case OSDPerfMetricSubKeyType::CLIENT_ADDRESS:
124124
#ifdef WITH_CRIMSON
125-
match_string = stringify(op.get_connection()->get_peer_addr());
125+
match_string = stringify(op.get_connection().get_peer_addr());
126126
#else
127127
match_string = stringify(m->get_connection()->get_peer_addr());
128128
#endif

0 commit comments

Comments
 (0)