diff options
author | Sage Weil <sage@newdream.net> | 2010-06-21 22:38:25 +0200 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-08-02 05:11:40 +0200 |
commit | ed0552a1a21d2f2692b84c366ce04ad17377780c (patch) | |
tree | ac660be5e7e6dae6a50c96a3ef7ce633bf550f41 /fs/ceph/mds_client.c | |
parent | ceph: only set num_pages in calc_layout (diff) | |
download | linux-ed0552a1a21d2f2692b84c366ce04ad17377780c.tar.xz linux-ed0552a1a21d2f2692b84c366ce04ad17377780c.zip |
ceph: introduce helper to connect to mds export targets
There are a few cases where we need to open sessions with a given mds's
potential export targets.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/mds_client.c')
-rw-r--r-- | fs/ceph/mds_client.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/fs/ceph/mds_client.c b/fs/ceph/mds_client.c index 641a8a37e7b3..462602ec7fb1 100644 --- a/fs/ceph/mds_client.c +++ b/fs/ceph/mds_client.c @@ -705,6 +705,43 @@ static int __open_session(struct ceph_mds_client *mdsc, } /* + * open sessions for any export targets for the given mds + * + * called under mdsc->mutex + */ +static void __open_export_target_sessions(struct ceph_mds_client *mdsc, + struct ceph_mds_session *session) +{ + struct ceph_mds_info *mi; + struct ceph_mds_session *ts; + int i, mds = session->s_mds; + int target; + + if (mds >= mdsc->mdsmap->m_max_mds) + return; + mi = &mdsc->mdsmap->m_info[mds]; + dout("open_export_target_sessions for mds%d (%d targets)\n", + session->s_mds, mi->num_export_targets); + + for (i = 0; i < mi->num_export_targets; i++) { + target = mi->export_targets[i]; + ts = __ceph_lookup_mds_session(mdsc, target); + if (!ts) { + ts = register_session(mdsc, target); + if (IS_ERR(ts)) + return; + } + if (session->s_state == CEPH_MDS_SESSION_NEW || + session->s_state == CEPH_MDS_SESSION_CLOSING) + __open_session(mdsc, session); + else + dout(" mds%d target mds%d %p is %s\n", session->s_mds, + i, ts, session_state_name(ts->s_state)); + ceph_put_mds_session(ts); + } +} + +/* * session caps */ |