return 0;
}
+/*
+ * Free preallocated cap messages assigned to this session
+ */
+static void cleanup_cap_releases(struct ceph_mds_session *session)
+{
+ struct ceph_msg *msg;
+
+ spin_lock(&session->s_cap_lock);
+ while (!list_empty(&session->s_cap_releases)) {
+ msg = list_first_entry(&session->s_cap_releases, struct ceph_msg,
+ list_head);
+ ceph_msg_remove(msg);
+ }
+ while (!list_empty(&session->s_cap_releases_done)) {
+ msg = list_first_entry(&session->s_cap_releases_done, struct ceph_msg,
+ list_head);
+ ceph_msg_remove(msg);
+ }
+ spin_unlock(&session->s_cap_lock);
+}
+
/*
* caller must hold session s_mutex
*/
ceph_remove_cap(cap);
}
BUG_ON(session->s_nr_caps > 0);
+
+ cleanup_cap_releases(session);
}
/*
break;
dout(5, "got ack for seq %llu type %d at %p\n", seq,
le16_to_cpu(m->hdr.type), m);
- list_del_init(&m->list_head);
- ceph_msg_put(m);
+ ceph_msg_remove(m);
}
spin_unlock(&con->out_queue_lock);
prepare_read_tag(con);
extern void ceph_msg_put(struct ceph_msg *msg);
+static inline void ceph_msg_remove(struct ceph_msg *msg)
+{
+ list_del_init(&msg->list_head);
+ ceph_msg_put(msg);
+}
+
static inline void ceph_msg_put_list(struct list_head *head)
{
while (!list_empty(head)) {
struct ceph_msg *msg = list_first_entry(head, struct ceph_msg,
list_head);
- list_del_init(&msg->list_head);
- ceph_msg_put(msg);
+ ceph_msg_remove(msg);
}
}