From 0c1cc687b6a40d3c6a26671f0652e1b51c3fd1af Mon Sep 17 00:00:00 2001 From: Samuel Just Date: Thu, 24 Jan 2013 12:02:09 -0800 Subject: [PATCH] FileStore: ping TPHandle after each operation in _do_transactions Each completed operation in the transaction proves thread liveness, a stuck thread should still trigger the timeouts. Fixes: #3928 Backport: bobtail Signed-off-by: Samuel Just --- src/os/FileStore.cc | 11 ++++++++--- src/os/FileStore.h | 14 +++++++++----- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/src/os/FileStore.cc b/src/os/FileStore.cc index 89d9cbf5445c..71039365e9c3 100644 --- a/src/os/FileStore.cc +++ b/src/os/FileStore.cc @@ -1946,7 +1946,7 @@ void FileStore::op_queue_release_throttle(Op *o) logger->set(l_os_oq_bytes, op_queue_bytes); } -void FileStore::_do_op(OpSequencer *osr) +void FileStore::_do_op(OpSequencer *osr, ThreadPool::TPHandle &handle) { // inject a stall? if (g_conf->filestore_inject_stall) { @@ -1962,7 +1962,7 @@ void FileStore::_do_op(OpSequencer *osr) Op *o = osr->peek_queue(); apply_manager.op_apply_start(o->op); dout(5) << "_do_op " << o << " seq " << o->op << " " << *osr << "/" << osr->parent << " start" << dendl; - int r = do_transactions(o->tls, o->op); + int r = _do_transactions(o->tls, o->op, &handle); apply_manager.op_apply_finish(o->op); dout(10) << "_do_op " << o << " seq " << o->op << " r = " << r << ", finisher " << o->onreadable << " " << o->onreadable_sync << dendl; @@ -2113,7 +2113,10 @@ void FileStore::_journaled_ahead(OpSequencer *osr, Op *o, Context *ondisk) } } -int FileStore::do_transactions(list &tls, uint64_t op_seq) +int FileStore::_do_transactions( + list &tls, + uint64_t op_seq, + ThreadPool::TPHandle *handle) { int r = 0; @@ -2132,6 +2135,8 @@ int FileStore::do_transactions(list &tls, uint64_t op_seq) r = _do_transaction(**p, op_seq, trans_num); if (r < 0) break; + if (handle) + handle->reset_tp_timeout(); } return r; diff --git a/src/os/FileStore.h b/src/os/FileStore.h index 912810ebc09f..b781de2b432b 100644 --- a/src/os/FileStore.h +++ b/src/os/FileStore.h @@ -228,8 +228,8 @@ private: store->op_queue.pop_front(); return osr; } - void _process(OpSequencer *osr) { - store->_do_op(osr); + void _process(OpSequencer *osr, ThreadPool::TPHandle &handle) { + store->_do_op(osr, handle); } void _process_finish(OpSequencer *osr) { store->_finish_op(osr); @@ -239,7 +239,7 @@ private: } } op_wq; - void _do_op(OpSequencer *o); + void _do_op(OpSequencer *o, ThreadPool::TPHandle &handle); void _finish_op(OpSequencer *o); Op *build_op(list& tls, Context *onreadable, Context *onreadable_sync, @@ -306,8 +306,12 @@ public: int statfs(struct statfs *buf); - int do_transactions(list &tls, uint64_t op_seq); - + int _do_transactions( + list &tls, uint64_t op_seq, + ThreadPool::TPHandle *handle); + int do_transactions(list &tls, uint64_t op_seq) { + return _do_transactions(tls, op_seq, 0); + } unsigned _do_transaction(Transaction& t, uint64_t op_seq, int trans_num); int queue_transaction(Sequencer *osr, Transaction* t); -- 2.47.3