CEPH filesystem development
 help / color / mirror / Atom feed
From: "Yan, Zheng" <zyan@redhat.com>
To: ceph-devel@vger.kernel.org
Cc: jlayton@redhat.com, "Yan, Zheng" <zyan@redhat.com>
Subject: [PATCH 4/5] ceph: close stopped mds' session
Date: Wed,  5 Apr 2017 09:30:18 +0800	[thread overview]
Message-ID: <20170405013019.5032-4-zyan@redhat.com> (raw)
In-Reply-To: <20170405013019.5032-1-zyan@redhat.com>

If a mds has stopped, close its session and clean up its session
requests/caps. The process is similar to handling SESSION_CLOSE
initiated by mds.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
---
 fs/ceph/mds_client.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c
index bf765a8..5584c98 100644
--- a/fs/ceph/mds_client.c
+++ b/fs/ceph/mds_client.c
@@ -3156,6 +3156,22 @@ static void check_new_map(struct ceph_mds_client *mdsc,
 				__unregister_session(mdsc, s);
 				__wake_requests(mdsc, &s->s_waiting);
 				ceph_put_mds_session(s);
+			} else if (i >= newmap->m_num_mds) {
+				/* force close session for stopped mds */
+				get_session(s);
+				__unregister_session(mdsc, s);
+				__wake_requests(mdsc, &s->s_waiting);
+				kick_requests(mdsc, i);
+				mutex_unlock(&mdsc->mutex);
+
+				mutex_lock(&s->s_mutex);
+				cleanup_session_requests(mdsc, s);
+				remove_session_caps(s);
+				mutex_unlock(&s->s_mutex);
+
+				ceph_put_mds_session(s);
+
+				mutex_lock(&mdsc->mutex);
 			} else {
 				/* just close it */
 				mutex_unlock(&mdsc->mutex);
-- 
2.9.3


  parent reply	other threads:[~2017-04-05  1:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-05  1:30 [PATCH 1/5] ceph: fix wrong check in ceph_renew_caps() Yan, Zheng
2017-04-05  1:30 ` [PATCH 2/5] ceph: allow connecting to mds whose rank >= mdsmap::m_max_mds Yan, Zheng
2017-04-05  4:39   ` Patrick Donnelly
2017-04-05 22:47   ` Luis Henriques
2017-04-05  1:30 ` [PATCH 3/5] ceph: fix potential use-after-free Yan, Zheng
2017-04-05 17:21   ` Jeff Layton
2017-04-05 23:59     ` Yan, Zheng
2017-04-05  1:30 ` Yan, Zheng [this message]
2017-04-05  1:30 ` [PATCH 5/5] ceph: make seeky readdir more efficiency Yan, Zheng
2017-04-05 14:16 ` [PATCH 1/5] ceph: fix wrong check in ceph_renew_caps() Jeff Layton
2017-04-06  0:04   ` Yan, Zheng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170405013019.5032-4-zyan@redhat.com \
    --to=zyan@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=jlayton@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox