From: Henrik Korkuc Date: Sun, 19 Feb 2017 09:44:20 +0000 (+0200) Subject: client/Client.cc: add feature to reconnect client after MDS reset X-Git-Tag: v11.2.1~28^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f458d60838628c4ed08448998956bc6ce7228f9b;p=ceph.git client/Client.cc: add feature to reconnect client after MDS reset 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 (cherry picked from commit e0bbc704676ef4aed510daff075ef63c9e73b7b3) --- diff --git a/doc/cephfs/client-config-ref.rst b/doc/cephfs/client-config-ref.rst index 7e2106a8875..f5eac8164f7 100644 --- a/doc/cephfs/client-config-ref.rst +++ b/doc/cephfs/client-config-ref.rst @@ -152,6 +152,12 @@ :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. diff --git a/src/client/Client.cc b/src/client/Client.cc index 2596920814d..83d5a289174 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -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: diff --git a/src/common/config_opts.h b/src/common/config_opts.h index 132d1897089..9522b9c93a7 100644 --- a/src/common/config_opts.h +++ b/src/common/config_opts.h @@ -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)