From: Xiubo Li Date: Tue, 11 Aug 2020 02:03:11 +0000 (+0800) Subject: client: defer cancelling the timer event X-Git-Tag: v16.1.0~1189^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=5f4b2170df536d2cc46086bbd0a4ff427bfa0f4c;p=ceph.git client: defer cancelling the timer event If there has to much data need to flush or the osd couldn't handle writting the data to disk and response on time, the client will be blacklisted by mds. Let's just defer cancelling the timer event just before closing the mds sessions. Fixes: https://tracker.ceph.com/issues/46905 Signed-off-by: Xiubo Li --- diff --git a/src/client/Client.cc b/src/client/Client.cc index a2c7dcc1ddba..2a96ea71eef8 100755 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -6217,6 +6217,7 @@ void Client::_unmount(bool abort) deleg_timeout = 0; if (abort) { + mount_aborted = true; // Abort all mds sessions _abort_mds_sessions(-ENOTCONN); @@ -6234,13 +6235,6 @@ void Client::_unmount(bool abort) return mds_requests.empty(); }); - { - std::scoped_lock l(timer_lock); - if (tick_event) - timer.cancel_event(tick_event); - tick_event = 0; - } - cwd.reset(); // clean up any unclosed files @@ -6327,6 +6321,13 @@ void Client::_unmount(bool abort) traceout.close(); } + { + std::scoped_lock l(timer_lock); + if (tick_event) + timer.cancel_event(tick_event); + tick_event = 0; + } + _close_sessions(); mref_writer.update_state(CLIENT_UNMOUNTED); @@ -6401,7 +6402,7 @@ void Client::tick() } } - if (mdsmap->get_epoch()) { + if (!mount_aborted && mdsmap->get_epoch()) { // renew caps? utime_t el = now - last_cap_renew; if (el > mdsmap->get_session_timeout() / 3.0) @@ -6415,13 +6416,15 @@ void Client::tick() while (!p.end()) { Inode *in = *p; ++p; - if (in->hold_caps_until > now) + if (!mount_aborted && in->hold_caps_until > now) break; delayed_list.pop_front(); - check_caps(in, CHECK_CAPS_NODELAY); + if (!mount_aborted) + check_caps(in, CHECK_CAPS_NODELAY); } - collect_and_send_metrics(); + if (!mount_aborted) + collect_and_send_metrics(); trim_cache(true); diff --git a/src/client/Client.h b/src/client/Client.h index b1d9ba9f969c..c1b4f57c1a45 100644 --- a/src/client/Client.h +++ b/src/client/Client.h @@ -1367,6 +1367,7 @@ private: ceph::unordered_set opened_dirs; uint64_t fd_gen = 1; + bool mount_aborted = false; bool blocklisted = false; ceph::unordered_map inode_map;