]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: store op request source info 16504/head
authorYan Jun <yan.jun8@zte.com.cn>
Sat, 22 Jul 2017 07:29:39 +0000 (15:29 +0800)
committerYan Jun <yan.jun8@zte.com.cn>
Sat, 22 Jul 2017 07:29:39 +0000 (15:29 +0800)
if we use command 'ceph daemon osd.# dump_historic_ops' to check the history
 tracked ops, the 'client_addr' is always dumped as '-' which result in clients
indistinguishable from each other.

"description": "osd_op(client.24123.0:328 3.36 3:6ec0d61b:::rbd_data.10472ae8944a.0000000000000289:head [write 4141056~4096 [fadvise_sequential]] snapc 0=[] ondisk+write+known_if_redirected e36)",
            "initiated_at": "2017-07-22 14:24:25.925633",
            "age": 4.893190,
            "duration": 0.272642,
            "type_data": {
                "flag_point": "commit sent; apply or cleanup",
                "client_info": {
                    "client": "client.24123",
                    "client_addr": "-",
                    "tid": 328
                },

It is because 'connection' was reset to nullptr in function '_unregistered'
before op has been inserted into history, so the 'get_source_addr' always return
empty entity addr.

Signed-off-by: Yan Jun <yan.jun8@zte.com.cn>
src/osd/OpRequest.cc
src/osd/OpRequest.h

index a71e35c90dfd91b729977eceedb9b3ff99ce964c..7d7f33e256a2c5d3b7b53d4187b93e0ee7ef2fe2 100644 (file)
@@ -39,6 +39,7 @@ OpRequest::OpRequest(Message *req, OpTracker *tracker) :
   } else if (req->get_type() == MSG_OSD_REPOP) {
     reqid = static_cast<MOSDRepOp*>(req)->reqid;
   }
+  req_src_inst = req->get_source_inst();
   mark_event("header_read", request->get_recv_stamp());
   mark_event("throttled", request->get_throttle_stamp());
   mark_event("all_read", request->get_recv_complete_stamp());
@@ -52,8 +53,8 @@ void OpRequest::_dump(Formatter *f) const
   if (m->get_orig_source().is_client()) {
     f->open_object_section("client_info");
     stringstream client_name, client_addr;
-    client_name << m->get_orig_source();
-    client_addr << m->get_orig_source_addr();
+    client_name << req_src_inst.name;
+    client_addr << req_src_inst.addr;
     f->dump_string("client", client_name.str());
     f->dump_string("client_addr", client_addr.str());
     f->dump_unsigned("tid", m->get_tid());
index 56663ecbd51cb1678cc1caa96a0a11e85a9ba813..8008bf08a12a875853385769c0a9291e8d31160d 100644 (file)
@@ -85,6 +85,7 @@ struct OpRequest : public TrackedOp {
 private:
   Message *request; /// the logical request we are tracking
   osd_reqid_t reqid;
+  entity_inst_t req_src_inst;
   uint8_t hit_flag_points;
   uint8_t latest_flag_point;
   utime_t dequeued_time;