summaryrefslogtreecommitdiffstats
path: root/fs/ceph/snap.c
diff options
context:
space:
mode:
authorSage Weil <sage@newdream.net>2010-02-22 15:12:16 -0800
committerSage Weil <sage@newdream.net>2010-02-23 14:26:35 -0800
commit2600d2dd5085ab6fb09540226138a60055abf335 (patch)
tree5aeb8a110eb7a41dab2d16b3a5ba8d67ad068a82 /fs/ceph/snap.c
parenta6369741c48815fedfce7072b7a9cd98b5bafd56 (diff)
downloadlinux-2600d2dd5085ab6fb09540226138a60055abf335.tar.bz2
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)
* directory into another realm.
*/
void ceph_handle_snap(struct ceph_mds_client *mdsc,
+ struct ceph_mds_session *session,
struct ceph_msg *msg)
{
struct super_block *sb = mdsc->client->sb;
- struct ceph_mds_session *session;
- int mds;
+ int mds = session->s_mds;
u64 split;
int op;
int trace_len;
@@ -730,10 +730,6 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
int i;
int locked_rwsem = 0;
- if (msg->hdr.src.name.type != CEPH_ENTITY_TYPE_MDS)
- return;
- mds = le64_to_cpu(msg->hdr.src.name.num);
-
/* decode */
if (msg->front.iov_len < sizeof(*h))
goto bad;
@@ -749,15 +745,6 @@ void ceph_handle_snap(struct ceph_mds_client *mdsc,
dout("handle_snap from mds%d op %s split %llx tracelen %d\n", mds,
ceph_snap_op_name(op), split, trace_len);
- /* find session */
- mutex_lock(&mdsc->mutex);
- session = __ceph_lookup_mds_session(mdsc, mds);
- mutex_unlock(&mdsc->mutex);
- if (!session) {
- dout("WTF, got snap but no session for mds%d\n", mds);
- return;
- }
-
mutex_lock(&session->s_mutex);
session->s_seq++;
mutex_unlock(&session->s_mutex);