]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client: auto reconnect using new entity addrs after blacklisted
authorYan, Zheng <zyan@redhat.com>
Mon, 8 Apr 2019 02:42:15 +0000 (10:42 +0800)
committerNathan Cutler <ncutler@suse.com>
Tue, 7 Jul 2020 15:25:28 +0000 (17:25 +0200)
Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
(cherry picked from commit 27da39ae5dfa18a323f6e544ead598bbb64fc774)

src/client/Client.cc
src/client/Client.h
src/common/legacy_config_opts.h

index c28ac4b504a6066014aad16f8afabe41dfb28e93..b638fb7fd7816956f7d5a6ea92f49ebba48f205d 100644 (file)
@@ -6321,6 +6321,15 @@ void Client::tick()
   }
 
   trim_cache(true);
+
+  if (blacklisted && mounted &&
+      last_auto_reconnect + 30 * 60 < now &&
+      cct->_conf.get_val<bool>("client_reconnect_stale")) {
+    messenger->client_reset();
+    blacklisted = false;
+    _kick_stale_sessions();
+    last_auto_reconnect = now;
+  }
 }
 
 void Client::renew_caps()
@@ -14122,8 +14131,7 @@ void Client::ms_handle_remote_reset(Connection *con)
        case MetaSession::STATE_OPEN:
          {
            objecter->maybe_request_map(); /* to check if we are blacklisted */
-           const auto& conf = cct->_conf;
-           if (conf->client_reconnect_stale) {
+           if (cct->_conf.get_val<bool>("client_reconnect_stale")) {
              ldout(cct, 1) << "reset from mds we were open; close mds session for reconnect" << dendl;
              _closed_mds_session(s);
            } else {
index 7ca604200eb462ae2263d19cca35ca35f4755686..b4393039f26a329d43c576b9183ab65954b9f823 100644 (file)
@@ -1264,6 +1264,8 @@ private:
   ceph::unordered_map<inodeno_t,SnapRealm*> snap_realms;
   std::map<std::string, std::string> metadata;
 
+  utime_t last_auto_reconnect;
+
   // trace generation
   ofstream traceout;
 
index b0562247dda99cac9344264548cfffa0e3550c54..847991b3cff02209f31f201c2aa7ef6dd1c02af2 100644 (file)
@@ -347,7 +347,6 @@ OPTION(client_trace, OPT_STR)
 OPTION(client_readahead_min, OPT_LONGLONG)  // readahead at _least_ this much.
 OPTION(client_readahead_max_bytes, OPT_LONGLONG)  // default unlimited
 OPTION(client_readahead_max_periods, OPT_LONGLONG)  // as multiple of file layout period (object size * num stripes)
-OPTION(client_reconnect_stale, OPT_BOOL)  // automatically reconnect stale session
 OPTION(client_snapdir, OPT_STR)
 OPTION(client_mount_uid, OPT_INT)
 OPTION(client_mount_gid, OPT_INT)