]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
client/Client.cc: add feature to reconnect client after MDS reset 13522/head
authorHenrik Korkuc <henrik@uber.com>
Sun, 19 Feb 2017 09:44:20 +0000 (11:44 +0200)
committerHenrik Korkuc <henrik@uber.com>
Wed, 12 Apr 2017 12:27:12 +0000 (15:27 +0300)
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>
doc/cephfs/client-config-ref.rst
src/client/Client.cc
src/common/config_opts.h

index a789a6d4d16c8bb51365729a2c05d81358ccf28a..ce5562fae406f9ee4ff9d03eaf81c4d5a20c6166 100644 (file)
 :Type: Integer
 :Default: ``131072`` (128KB)
 
+``client_reconnect_stale``
+
+:Description: Automatically reconnect stale session.
+:Type: Boolean
+:Default: ``false``
+
 ``client_snapdir``
 
 :Description: Set the snapshot directory name.
index 8d711553fc8f23e6b8ff98ffa7cd39f9615caebc..e336d1611e546e22dfb65254ff602a1cacabf315 100644 (file)
@@ -12708,8 +12708,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 c9a9beefff6865f33461a7ef86ec5675431d4ef9..8794f50c8b9b06b058f268a1b7130d3c09938b25 100644 (file)
@@ -423,6 +423,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)