diff options
author | Sage Weil <sage@newdream.net> | 2009-10-14 20:26:40 -0400 |
---|---|---|
committer | Sage Weil <sage@newdream.net> | 2009-10-15 21:14:42 -0400 |
commit | 07bd10fb9853a41a7f0bb271721cca97d15eccae (patch) | |
tree | e7720633e7ce7be5dd3e9a9f96f1d63e3095b06c /fs | |
parent | afcdaea3f2a78ce4873bd7e98a6d603bda23d167 (diff) |
ceph: correct subscribe_ack msgpool payload size
Defined a struct for the SUBSCRIBE_ACK, and use that to size
the msgpool.
Signed-off-by: Sage Weil <sage@newdream.net>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ceph/ceph_fs.h | 5 | ||||
-rw-r--r-- | fs/ceph/mon_client.c | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/fs/ceph/ceph_fs.h b/fs/ceph/ceph_fs.h index 56af192cb430..9b16e2e06ea6 100644 --- a/fs/ceph/ceph_fs.h +++ b/fs/ceph/ceph_fs.h | |||
@@ -162,6 +162,11 @@ struct ceph_mon_subscribe_item { | |||
162 | __u8 onetime; | 162 | __u8 onetime; |
163 | } __attribute__ ((packed)); | 163 | } __attribute__ ((packed)); |
164 | 164 | ||
165 | struct ceph_mon_subscribe_ack { | ||
166 | __le32 duration; /* seconds */ | ||
167 | struct ceph_fsid fsid; | ||
168 | } __attribute__ ((packed)); | ||
169 | |||
165 | /* | 170 | /* |
166 | * mds states | 171 | * mds states |
167 | * > 0 -> in | 172 | * > 0 -> in |
diff --git a/fs/ceph/mon_client.c b/fs/ceph/mon_client.c index bea2be9077e4..d52e52968d01 100644 --- a/fs/ceph/mon_client.c +++ b/fs/ceph/mon_client.c | |||
@@ -199,10 +199,12 @@ static void handle_subscribe_ack(struct ceph_mon_client *monc, | |||
199 | struct ceph_msg *msg) | 199 | struct ceph_msg *msg) |
200 | { | 200 | { |
201 | unsigned seconds; | 201 | unsigned seconds; |
202 | void *p = msg->front.iov_base; | 202 | struct ceph_mon_subscribe_ack *h = msg->front.iov_base; |
203 | void *end = p + msg->front.iov_len; | 203 | |
204 | if (msg->front.iov_len < sizeof(*h)) | ||
205 | goto bad; | ||
206 | seconds = le32_to_cpu(h->duration); | ||
204 | 207 | ||
205 | ceph_decode_32_safe(&p, end, seconds, bad); | ||
206 | mutex_lock(&monc->mutex); | 208 | mutex_lock(&monc->mutex); |
207 | if (monc->hunting) { | 209 | if (monc->hunting) { |
208 | pr_info("mon%d %s session established\n", | 210 | 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 | err = ceph_msgpool_init(&monc->msgpool_mount_ack, 4096, 1, false); | 543 | err = ceph_msgpool_init(&monc->msgpool_mount_ack, 4096, 1, false); |
542 | if (err < 0) | 544 | if (err < 0) |
543 | goto out; | 545 | goto out; |
544 | err = ceph_msgpool_init(&monc->msgpool_subscribe_ack, 8, 1, false); | 546 | err = ceph_msgpool_init(&monc->msgpool_subscribe_ack, |
547 | sizeof(struct ceph_mon_subscribe_ack), 1, false); | ||
545 | if (err < 0) | 548 | if (err < 0) |
546 | goto out; | 549 | goto out; |
547 | err = ceph_msgpool_init(&monc->msgpool_statfs_reply, | 550 | err = ceph_msgpool_init(&monc->msgpool_statfs_reply, |