|
@@ -1552,9 +1552,15 @@ void ceph_send_cap_releases(struct ceph_mds_client *mdsc,
|
|
|
struct ceph_msg *msg = NULL;
|
|
|
struct ceph_mds_cap_release *head;
|
|
|
struct ceph_mds_cap_item *item;
|
|
|
+ struct ceph_osd_client *osdc = &mdsc->fsc->client->osdc;
|
|
|
struct ceph_cap *cap;
|
|
|
LIST_HEAD(tmp_list);
|
|
|
int num_cap_releases;
|
|
|
+ __le32 barrier, *cap_barrier;
|
|
|
+
|
|
|
+ down_read(&osdc->lock);
|
|
|
+ barrier = cpu_to_le32(osdc->epoch_barrier);
|
|
|
+ up_read(&osdc->lock);
|
|
|
|
|
|
spin_lock(&session->s_cap_lock);
|
|
|
again:
|
|
@@ -1572,7 +1578,11 @@ again:
|
|
|
head = msg->front.iov_base;
|
|
|
head->num = cpu_to_le32(0);
|
|
|
msg->front.iov_len = sizeof(*head);
|
|
|
+
|
|
|
+ msg->hdr.version = cpu_to_le16(2);
|
|
|
+ msg->hdr.compat_version = cpu_to_le16(1);
|
|
|
}
|
|
|
+
|
|
|
cap = list_first_entry(&tmp_list, struct ceph_cap,
|
|
|
session_caps);
|
|
|
list_del(&cap->session_caps);
|
|
@@ -1590,6 +1600,11 @@ again:
|
|
|
ceph_put_cap(mdsc, cap);
|
|
|
|
|
|
if (le32_to_cpu(head->num) == CEPH_CAPS_PER_RELEASE) {
|
|
|
+ // Append cap_barrier field
|
|
|
+ cap_barrier = msg->front.iov_base + msg->front.iov_len;
|
|
|
+ *cap_barrier = barrier;
|
|
|
+ msg->front.iov_len += sizeof(*cap_barrier);
|
|
|
+
|
|
|
msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
|
|
|
dout("send_cap_releases mds%d %p\n", session->s_mds, msg);
|
|
|
ceph_con_send(&session->s_con, msg);
|
|
@@ -1605,6 +1620,11 @@ again:
|
|
|
spin_unlock(&session->s_cap_lock);
|
|
|
|
|
|
if (msg) {
|
|
|
+ // Append cap_barrier field
|
|
|
+ cap_barrier = msg->front.iov_base + msg->front.iov_len;
|
|
|
+ *cap_barrier = barrier;
|
|
|
+ msg->front.iov_len += sizeof(*cap_barrier);
|
|
|
+
|
|
|
msg->hdr.front_len = cpu_to_le32(msg->front.iov_len);
|
|
|
dout("send_cap_releases mds%d %p\n", session->s_mds, msg);
|
|
|
ceph_con_send(&session->s_con, msg);
|