]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client/Client.cc: add feature to reconnect client after MDS reset 16105/head
authorHenrik Korkuc <henrik@uber.com>
Sun, 19 Feb 2017 09:44:20 +0000 (11:44 +0200)
committerNathan Cutler <ncutler@suse.com>
Tue, 4 Jul 2017 11:12:01 +0000 (13:12 +0200)
Client.cc marks session as stale instead of reconecting after received
reset from MDS. On MDS side session is closed so MDS is ignoring cap
renew. This adds option to reconnect stale client sessions instead of
just marking sessions stale.

Fixes: http://tracker.ceph.com/issues/18757
Signed-off-by: Henrik Korkuc <henrik@kirneh.eu>
(cherry picked from commit e0bbc704676ef4aed510daff075ef63c9e73b7b3)

doc/cephfs/client-config-ref.rst
src/client/Client.cc
src/common/config_opts.h

index 7e2106a8875016635f00ab1abcda834ebfda4b89..f5eac8164f7c14170d43687c66af4d23595a591e 100644 (file)
 :Type: Integer
 :Default: ``131072`` (128KB)
 
+``client_reconnect_stale``
+
+:Description: Automatically reconnect stale session.
+:Type: Boolean
+:Default: ``false``
+
 ``client_snapdir``
 
 :Description: Name for the snapshot directory.
index 2596920814d0c813e3f6a1635cd812ed6046e472..83d5a289174b220c107e191b6c604501369c3f31 100644 (file)
@@ -12728,8 +12728,16 @@ void Client::ms_handle_remote_reset(Connection *con)
          break;
 
        case MetaSession::STATE_OPEN:
-         ldout(cct, 1) << "reset from mds we were open; mark session as stale" << dendl;
-         s->state = MetaSession::STATE_STALE;
+         {
+           const md_config_t *conf = cct->_conf;
+           if (conf->client_reconnect_stale) {
+             ldout(cct, 1) << "reset from mds we were open; close mds session for reconnect" << dendl;
+             _closed_mds_session(s);
+           } else {
+             ldout(cct, 1) << "reset from mds we were open; mark session as stale" << dendl;
+             s->state = MetaSession::STATE_STALE;
+           }
+         }
          break;
 
        case MetaSession::STATE_NEW:
index 132d18970894ec964c9b21f2a1946ef4c05bd47a..9522b9c93a76d223f330405ff3dc38fdb1253075 100644 (file)
@@ -406,6 +406,7 @@ OPTION(client_trace, OPT_STR, "")
 OPTION(client_readahead_min, OPT_LONGLONG, 128*1024)  // readahead at _least_ this much.
 OPTION(client_readahead_max_bytes, OPT_LONGLONG, 0)  // default unlimited
 OPTION(client_readahead_max_periods, OPT_LONGLONG, 4)  // as multiple of file layout period (object size * num stripes)
+OPTION(client_reconnect_stale, OPT_BOOL, false)  // automatically reconnect stale session
 OPTION(client_snapdir, OPT_STR, ".snap")
 OPTION(client_mountpoint, OPT_STR, "/")
 OPTION(client_mount_uid, OPT_INT, -1)