aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/caps.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-06-21 16:45:04 -0400
committerSage Weil <sage@newdream.net>2010-08-01 23:11:41 -0400
commit154f42c2c3c3b66a7a63dad5648e8a9860a32af9 (patch)
tree408beec027a62dcb67f212b07590039aea22866b /fs/ceph/caps.c
parentcb170a22153730eb9c82b6c85ead2001dba6c41a (diff)
ceph: connect to export targets on cap export
When we get a cap EXPORT message, make sure we are connected to all export targets to ensure we can handle the matching IMPORT. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/caps.c')
-rw-r--r--fs/ceph/caps.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 47068b10baf8..52befa65fbf7 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2573,7 +2573,8 @@ static void handle_cap_trunc(struct inode *inode,
2573 * caller holds s_mutex 2573 * caller holds s_mutex
2574 */ 2574 */
2575static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex, 2575static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
2576 struct ceph_mds_session *session) 2576 struct ceph_mds_session *session,
2577 int *open_target_sessions)
2577{ 2578{
2578 struct ceph_inode_info *ci = ceph_inode(inode); 2579 struct ceph_inode_info *ci = ceph_inode(inode);
2579 int mds = session->s_mds; 2580 int mds = session->s_mds;
@@ -2605,6 +2606,12 @@ static void handle_cap_export(struct inode *inode, struct ceph_mds_caps *ex,
2605 ci->i_cap_exporting_mds = mds; 2606 ci->i_cap_exporting_mds = mds;
2606 ci->i_cap_exporting_mseq = mseq; 2607 ci->i_cap_exporting_mseq = mseq;
2607 ci->i_cap_exporting_issued = cap->issued; 2608 ci->i_cap_exporting_issued = cap->issued;
2609
2610 /*
2611 * make sure we have open sessions with all possible
2612 * export targets, so that we get the matching IMPORT
2613 */
2614 *open_target_sessions = 1;
2608 } 2615 }
2609 __ceph_remove_cap(cap); 2616 __ceph_remove_cap(cap);
2610 } 2617 }
@@ -2680,6 +2687,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2680 u64 size, max_size; 2687 u64 size, max_size;
2681 u64 tid; 2688 u64 tid;
2682 void *snaptrace; 2689 void *snaptrace;
2690 int open_target_sessions = 0;
2683 2691
2684 dout("handle_caps from mds%d\n", mds); 2692 dout("handle_caps from mds%d\n", mds);
2685 2693
@@ -2731,7 +2739,7 @@ void ceph_handle_caps(struct ceph_mds_session *session,
2731 goto done; 2739 goto done;
2732 2740
2733 case CEPH_CAP_OP_EXPORT: 2741 case CEPH_CAP_OP_EXPORT:
2734 handle_cap_export(inode, h, session); 2742 handle_cap_export(inode, h, session, &open_target_sessions);
2735 goto done; 2743 goto done;
2736 2744
2737 case CEPH_CAP_OP_IMPORT: 2745 case CEPH_CAP_OP_IMPORT:
@@ -2778,6 +2786,8 @@ done:
2778done_unlocked: 2786done_unlocked:
2779 if (inode) 2787 if (inode)
2780 iput(inode); 2788 iput(inode);
2789 if (open_target_sessions)
2790 ceph_mdsc_open_export_target_sessions(mdsc, session);
2781 return; 2791 return;
2782 2792
2783bad: 2793bad: