diff options
author | Sage Weil <sage@newdream.net> | 2010-06-21 16:38:25 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2010-08-01 23:11:40 -0400 |
commit | ed0552a1a21d2f2692b84c366ce04ad17377780c (patch) | |
tree | ac660be5e7e6dae6a50c96a3ef7ce633bf550f41 /fs/ceph/mds_client.c | |
parent | 796d6955a51ce6768d0e033f27a2f8f5be6cb39a (diff) |
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, | |||
705 | } | 705 | } |
706 | 706 | ||
707 | /* | 707 | /* |
708 | * open sessions for any export targets for the given mds | ||
709 | * | ||
710 | * called under mdsc->mutex | ||
711 | */ | ||
712 | static void __open_export_target_sessions(struct ceph_mds_client *mdsc, | ||
713 | struct ceph_mds_session *session) | ||
714 | { | ||
715 | struct ceph_mds_info *mi; | ||
716 | struct ceph_mds_session *ts; | ||
717 | int i, mds = session->s_mds; | ||
718 | int target; | ||
719 | |||
720 | if (mds >= mdsc->mdsmap->m_max_mds) | ||
721 | return; | ||
722 | mi = &mdsc->mdsmap->m_info[mds]; | ||
723 | dout("open_export_target_sessions for mds%d (%d targets)\n", | ||
724 | session->s_mds, mi->num_export_targets); | ||
725 | |||
726 | for (i = 0; i < mi->num_export_targets; i++) { | ||
727 | target = mi->export_targets[i]; | ||
728 | ts = __ceph_lookup_mds_session(mdsc, target); | ||
729 | if (!ts) { | ||
730 | ts = register_session(mdsc, target); | ||
731 | if (IS_ERR(ts)) | ||
732 | return; | ||
733 | } | ||
734 | if (session->s_state == CEPH_MDS_SESSION_NEW || | ||
735 | session->s_state == CEPH_MDS_SESSION_CLOSING) | ||
736 | __open_session(mdsc, session); | ||
737 | else | ||
738 | dout(" mds%d target mds%d %p is %s\n", session->s_mds, | ||
739 | i, ts, session_state_name(ts->s_state)); | ||
740 | ceph_put_mds_session(ts); | ||
741 | } | ||
742 | } | ||
743 | |||
744 | /* | ||
708 | * session caps | 745 | * session caps |
709 | */ | 746 | */ |
710 | 747 | ||