diff options
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 | ||