diff --git a/src/common/TrackedOp.cc b/src/common/TrackedOp.cc index fbd30b81528..a96b9159917 100644 --- a/src/common/TrackedOp.cc +++ b/src/common/TrackedOp.cc @@ -158,9 +158,8 @@ bool OpTracker::check_ops_in_flight(std::vector &warning_vector) utime_t now = ceph_clock_now(cct); utime_t too_old = now; too_old -= complaint_time; - utime_t oldest_op; + utime_t oldest_op = now; uint64_t total_ops_in_flight = 0; - bool got_first_op = false; for (uint32_t i = 0; i < num_optracker_shards; i++) { ShardedTrackingData* sdata = sharded_in_flight_list[i]; @@ -168,10 +167,7 @@ bool OpTracker::check_ops_in_flight(std::vector &warning_vector) Mutex::Locker locker(sdata->ops_in_flight_lock_sharded); if (!sdata->ops_in_flight_sharded.empty()) { utime_t oldest_op_tmp = sdata->ops_in_flight_sharded.front()->get_initiated(); - if (!got_first_op) { - oldest_op = oldest_op_tmp; - got_first_op = true; - } else if (oldest_op_tmp < oldest_op) { + if (oldest_op_tmp < oldest_op) { oldest_op = oldest_op_tmp; } } @@ -298,12 +294,12 @@ void OpTracker::_mark_event(TrackedOp *op, const string &evt, } void OpTracker::RemoveOnDelete::operator()(TrackedOp *op) { - op->mark_event("done"); if (!tracker->tracking_enabled) { op->_unregistered(); delete op; return; } + op->mark_event("done"); tracker->unregister_inflight_op(op); // Do not delete op, unregister_inflight_op took control } diff --git a/src/common/TrackedOp.h b/src/common/TrackedOp.h index 42d1eafe700..b2015b88f96 100644 --- a/src/common/TrackedOp.h +++ b/src/common/TrackedOp.h @@ -161,7 +161,8 @@ protected: warn_interval_multiplier(1) { tracker->register_inflight_op(&xitem); - events.push_back(make_pair(initiated_at, "initiated")); + if (tracker->tracking_enabled) + events.push_back(make_pair(initiated_at, "initiated")); } /// output any type-specific data you want to get when dump() is called