From: Patrick Donnelly Date: Fri, 21 Jul 2023 16:56:27 +0000 (-0400) Subject: mds: lock TrackedOp when dumping X-Git-Tag: v19.0.0~692^2~8 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9d75d6b0bdfe18ffb6f345bacb02dc602d014398;p=ceph.git mds: lock TrackedOp when dumping The MDS does not generally bother locking a Mutation before changing anything so this lock provides weak protection. In any case, try to improve on that... Signed-off-by: Patrick Donnelly --- diff --git a/src/mds/Mutation.cc b/src/mds/Mutation.cc index 518c68b679c7..b009bb38ffc8 100644 --- a/src/mds/Mutation.cc +++ b/src/mds/Mutation.cc @@ -481,6 +481,7 @@ void MDRequestImpl::dump(Formatter *f) const void MDRequestImpl::_dump(Formatter *f) const { + std::lock_guard l(lock); f->dump_string("flag_point", _get_state_string()); f->dump_stream("reqid") << reqid; { @@ -527,9 +528,9 @@ void MDRequestImpl::_dump(Formatter *f) const f->dump_string("op_type", "no_available_op_found"); } } + { f->open_array_section("events"); - std::lock_guard l(lock); for (auto& i : events) { f->dump_object("event", i); }