Merge pull request #13522 from singler/wip-reconnect-client

client/Client.cc: after reset session from MDS - reconnect

Reviewed-by: Yan, Zheng <zyan@redhat.com>
This commit is contained in:
John Spray 2017-04-15 19:44:53 +01:00 committed by GitHub
commit 177699981e
3 changed files with 17 additions and 2 deletions

View File

@ -147,6 +147,12 @@
: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.

View File

@ -12739,8 +12739,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:

View 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)