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>
This commit is contained in:
Sage Weil
2010-02-22 15:12:16 -08:00
parent a6369741c4
commit 2600d2dd50
4 changed files with 46 additions and 59 deletions

View File

@@ -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);