]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: lock TrackedOp when dumping
authorPatrick Donnelly <pdonnell@redhat.com>
Fri, 21 Jul 2023 16:56:27 +0000 (12:56 -0400)
committerPatrick Donnelly <pdonnell@redhat.com>
Tue, 8 Aug 2023 12:58:41 +0000 (08:58 -0400)
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 <pdonnell@redhat.com>
src/mds/Mutation.cc

index 518c68b679c7cfbca69f580bb89b038fa01f5079..b009bb38ffc8a41c0dc8a1d209274bc6ee0d0daf 100644 (file)
@@ -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);
     }