Commit 07bd10fb authored by Sage Weil's avatar Sage Weil

ceph: correct subscribe_ack msgpool payload size

Defined a struct for the SUBSCRIBE_ACK, and use that to size
the msgpool.
Signed-off-by: default avatarSage Weil <sage@newdream.net>
parent afcdaea3
...@@ -162,6 +162,11 @@ struct ceph_mon_subscribe_item { ...@@ -162,6 +162,11 @@ struct ceph_mon_subscribe_item {
__u8 onetime; __u8 onetime;
} __attribute__ ((packed)); } __attribute__ ((packed));
struct ceph_mon_subscribe_ack {
__le32 duration; /* seconds */
struct ceph_fsid fsid;
} __attribute__ ((packed));
/* /*
* mds states * mds states
* > 0 -> in * > 0 -> in
......
...@@ -199,10 +199,12 @@ static void handle_subscribe_ack(struct ceph_mon_client *monc, ...@@ -199,10 +199,12 @@ static void handle_subscribe_ack(struct ceph_mon_client *monc,
struct ceph_msg *msg) struct ceph_msg *msg)
{ {
unsigned seconds; unsigned seconds;
void *p = msg->front.iov_base; struct ceph_mon_subscribe_ack *h = msg->front.iov_base;
void *end = p + msg->front.iov_len;
if (msg->front.iov_len < sizeof(*h))
goto bad;
seconds = le32_to_cpu(h->duration);
ceph_decode_32_safe(&p, end, seconds, bad);
mutex_lock(&monc->mutex); mutex_lock(&monc->mutex);
if (monc->hunting) { if (monc->hunting) {
pr_info("mon%d %s session established\n", pr_info("mon%d %s session established\n",
...@@ -541,7 +543,8 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) ...@@ -541,7 +543,8 @@ int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl)
err = ceph_msgpool_init(&monc->msgpool_mount_ack, 4096, 1, false); err = ceph_msgpool_init(&monc->msgpool_mount_ack, 4096, 1, false);
if (err < 0) if (err < 0)
goto out; goto out;
err = ceph_msgpool_init(&monc->msgpool_subscribe_ack, 8, 1, false); err = ceph_msgpool_init(&monc->msgpool_subscribe_ack,
sizeof(struct ceph_mon_subscribe_ack), 1, false);
if (err < 0) if (err < 0)
goto out; goto out;
err = ceph_msgpool_init(&monc->msgpool_statfs_reply, err = ceph_msgpool_init(&monc->msgpool_statfs_reply,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment