From: Sage Weil Date: Fri, 9 Jan 2009 20:55:59 +0000 (-0800) Subject: kclient: list unsafe requests in the MDS session X-Git-Tag: v0.6~1^2~105 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=95fa0a12a82a00f123ef724b52d245ed92c704ac;p=ceph.git kclient: list unsafe requests in the MDS session This easily defines the requests needed during reconnect without having to consult the larger request table. --- diff --git a/src/kernel/mds_client.c b/src/kernel/mds_client.c index 66c45f59252a2..8fc58a70a4a36 100644 --- a/src/kernel/mds_client.c +++ b/src/kernel/mds_client.c @@ -327,6 +327,7 @@ static struct ceph_mds_session *register_session(struct ceph_mds_client *mdsc, s->s_nr_caps = 0; atomic_set(&s->s_ref, 1); init_completion(&s->s_completion); + INIT_LIST_HEAD(&s->s_unsafe); dout(10, "register_session mds%d\n", mds); if (mds >= mdsc->max_sessions) { @@ -1292,18 +1293,18 @@ void ceph_mdsc_handle_reply(struct ceph_mds_client *mdsc, struct ceph_msg *msg) if (req->r_got_unsafe && head->safe) { /* - * We already handled the unsafe response, now - * do the cleanup. Shouldn't we check the - * safe response to see if it matches the - * unsafe one? + * We already handled the unsafe response, now do the + * cleanup. No need to examine the response; the MDS + * doesn't include any result info in the safe + * response. And even if it did, there is nothing + * useful we could do with a revised return value. */ + dout(10, "got safe reply %llu, mds%d\n", tid, mds); + BUG_ON(req->r_session == NULL); complete(&req->r_safe_completion); __unregister_request(mdsc, req); - dout(10, "got safe reply %llu, mds%d\n", - tid, mds); - ceph_msg_put(req->r_request); - req->r_request = NULL; req->r_got_safe = true; + list_del_init(&req->r_unsafe_item); mutex_unlock(&mdsc->mutex); ceph_mdsc_put_request(req); return; @@ -1324,8 +1325,10 @@ void ceph_mdsc_handle_reply(struct ceph_mds_client *mdsc, struct ceph_msg *msg) if (head->safe) req->r_got_safe = true; - else + else { req->r_got_unsafe = true; + list_add_tail(&req->r_unsafe_item, &req->r_session->s_unsafe); + } /* take the snap sem -- we may be are adding a cap here */ down_write(&mdsc->snap_rwsem); diff --git a/src/kernel/mds_client.h b/src/kernel/mds_client.h index 4334fe454bbee..0f0a644552107 100644 --- a/src/kernel/mds_client.h +++ b/src/kernel/mds_client.h @@ -119,6 +119,7 @@ struct ceph_mds_session { int s_nr_caps; atomic_t s_ref; struct completion s_completion; + struct list_head s_unsafe; /* unsafe requests */ }; /* @@ -174,6 +175,7 @@ struct ceph_mds_request { atomic_t r_ref; struct completion r_completion; struct completion r_safe_completion; + struct list_head r_unsafe_item; /* per-session unsafe list item */ bool r_got_unsafe, r_got_safe; };