aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ceph/snap.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-02-22 18:12:16 -0500
committerSage Weil <sage@newdream.net>2010-02-23 17:26:35 -0500
commit2600d2dd5085ab6fb09540226138a60055abf335 (patch)
tree5aeb8a110eb7a41dab2d16b3a5ba8d67ad068a82 /fs/ceph/snap.c
parenta6369741c48815fedfce7072b7a9cd98b5bafd56 (diff)
ceph: drop messages on unregistered mds sessions; cleanup
Verify the mds session is currently registered before handling incoming messages. Clean up message handlers to pull mds out of session->s_mds instead of less trustworthy src field. Clean up con_{get,put} debug output. Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs/ceph/snap.c')
-rw-r--r--fs/ceph/snap.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/fs/ceph/snap.c b/fs/ceph/snap.c
index 49d0c4c59d81..bf2a5f3846a4 100644
--- a/fs/ceph/snap.c
+++ b/fs/ceph/snap.c
@@ -713,11 +713,11 @@ static void flush_snaps(struct ceph_mds_client *mdsc)
713 * directory into another realm. 713 * directory into another realm.
714 */ 714 */
715void ceph_handle_snap(struct ceph_mds_client *mdsc, 715void ceph_handle_snap(struct ceph_mds_client *mdsc,
716 struct ceph_mds_session *session,
716 struct ceph_msg *msg) 717 struct ceph_msg *msg)
717{ 718{
718 struct super_block *sb = mdsc->client->sb; 719 struct super_block *sb = mdsc->client->sb;
719 struct ceph_mds_session *session; 720 int mds = session->s_mds;
720 int mds;
721 u64 split; 721 u64 split;
722 int op; 722 int op;
723 int trace_len; 723 int trace_len;
@@ -730,10 +730,6 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
730 int i; 730 int i;
731 int locked_rwsem = 0; 731 int locked_rwsem = 0;
732 732
733 if (msg->hdr.src.name.type != CEPH_ENTITY_TYPE_MDS)
734 return;
735 mds = le64_to_cpu(msg->hdr.src.name.num);
736
737 /* decode */ 733 /* decode */
738 if (msg->front.iov_len < sizeof(*h)) 734 if (msg->front.iov_len < sizeof(*h))
739 goto bad; 735 goto bad;
@@ -749,15 +745,6 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
749 dout("handle_snap from mds%d op %s split %llx tracelen %d\n", mds, 745 dout("handle_snap from mds%d op %s split %llx tracelen %d\n", mds,
750 ceph_snap_op_name(op), split, trace_len); 746 ceph_snap_op_name(op), split, trace_len);
751 747
752 /* find session */
753 mutex_lock(&mdsc->mutex);
754 session = __ceph_lookup_mds_session(mdsc, mds);
755 mutex_unlock(&mdsc->mutex);
756 if (!session) {
757 dout("WTF, got snap but no session for mds%d\n", mds);
758 return;
759 }
760
761 mutex_lock(&session->s_mutex); 748 mutex_lock(&session->s_mutex);
762 session->s_seq++; 749 session->s_seq++;
763 mutex_unlock(&session->s_mutex); 750 mutex_unlock(&session->s_mutex);