From: Sage Weil Date: Mon, 8 Feb 2016 14:14:21 +0000 (-0500) Subject: Merge branch 'print-blocked-op' of git://github.com/majianpeng/ceph X-Git-Tag: v10.0.4~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7e442996186ea35ca37ab571b3f17b0fb8984cb9;p=ceph.git Merge branch 'print-blocked-op' of git://github.com/majianpeng/ceph Reviewed-by: Sage Weil --- 7e442996186ea35ca37ab571b3f17b0fb8984cb9 diff --cc src/common/TrackedOp.h index 3663290ec08e,3b60771060c2..c1d8eb6ad6f6 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@@ -100,11 -97,7 +100,11 @@@ public void set_history_size_and_duration(uint32_t new_size, uint32_t new_duration) { history.set_size_and_duration(new_size, new_duration); } + void set_tracking(bool enable) { + RWLock::WLocker l(lock); + tracking_enabled = enable; + } - void dump_ops_in_flight(Formatter *f); + void dump_ops_in_flight(Formatter *f, bool print_only_blocked=false); void dump_historic_ops(Formatter *f); void register_inflight_op(xlist::item *i); void unregister_inflight_op(TrackedOp *i); diff --cc src/mds/MDSRank.cc index 090982ecf0a9,65a9d3008626..fcf27330bd84 --- a/src/mds/MDSRank.cc +++ b/src/mds/MDSRank.cc @@@ -1667,16 -1634,23 +1667,25 @@@ bool MDSRankDispatcher::handle_asok_com { if (command == "dump_ops_in_flight" || command == "ops") { + RWLock::RLocker l(op_tracker.lock); if (!op_tracker.tracking_enabled) { - ss << "op_tracker tracking is not enabled"; + ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ + please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; } else { op_tracker.dump_ops_in_flight(f); } + } else if (command == "dump_blocked_ops") { + if (!op_tracker.tracking_enabled) { + ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ + Please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; + } else { + op_tracker.dump_ops_in_flight(f, true); + } } else if (command == "dump_historic_ops") { + RWLock::RLocker l(op_tracker.lock); if (!op_tracker.tracking_enabled) { - ss << "op_tracker tracking is not enabled"; + ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ + please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; } else { op_tracker.dump_historic_ops(f); } diff --cc src/osd/OSD.cc index 2d60d4cbbca9,3683a0b82671..7345d535301b --- a/src/osd/OSD.cc +++ b/src/osd/OSD.cc @@@ -1703,16 -1659,24 +1703,26 @@@ bool OSD::asok_command(string command, store->flush_journal(); } else if (command == "dump_ops_in_flight" || command == "ops") { + RWLock::RLocker l(op_tracker.lock); if (!op_tracker.tracking_enabled) { - ss << "op_tracker tracking is not enabled"; + ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ + Please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; } else { op_tracker.dump_ops_in_flight(f); } + } else if (command == "dump_blocked_ops") { + if (!op_tracker.tracking_enabled) { + ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ + Please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; + } else { + op_tracker.dump_ops_in_flight(f, true); + } + } else if (command == "dump_historic_ops") { + RWLock::RLocker l(op_tracker.lock); if (!op_tracker.tracking_enabled) { - ss << "op_tracker tracking is not enabled"; + ss << "op_tracker tracking is not enabled now, so no ops are tracked currently, even those get stuck. \ + Please enable \"osd_enable_op_tracker\", and the tracker will start to track new ops received afterwards."; } else { op_tracker.dump_historic_ops(f); }