diff options
Diffstat (limited to 'net/ceph/messenger.c')
-rw-r--r-- | net/ceph/messenger.c | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 4a5df7b1cc9f..2ed1304d22a7 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/dns_resolver.h> | 15 | #include <linux/dns_resolver.h> |
16 | #include <net/tcp.h> | 16 | #include <net/tcp.h> |
17 | 17 | ||
18 | #include <linux/ceph/ceph_features.h> | ||
18 | #include <linux/ceph/libceph.h> | 19 | #include <linux/ceph/libceph.h> |
19 | #include <linux/ceph/messenger.h> | 20 | #include <linux/ceph/messenger.h> |
20 | #include <linux/ceph/decode.h> | 21 | #include <linux/ceph/decode.h> |
@@ -1865,7 +1866,9 @@ int ceph_parse_ips(const char *c, const char *end, | |||
1865 | port = (port * 10) + (*p - '0'); | 1866 | port = (port * 10) + (*p - '0'); |
1866 | p++; | 1867 | p++; |
1867 | } | 1868 | } |
1868 | if (port > 65535 || port == 0) | 1869 | if (port == 0) |
1870 | port = CEPH_MON_PORT; | ||
1871 | else if (port > 65535) | ||
1869 | goto bad; | 1872 | goto bad; |
1870 | } else { | 1873 | } else { |
1871 | port = CEPH_MON_PORT; | 1874 | port = CEPH_MON_PORT; |
@@ -1945,7 +1948,8 @@ static int process_connect(struct ceph_connection *con) | |||
1945 | { | 1948 | { |
1946 | u64 sup_feat = con->msgr->supported_features; | 1949 | u64 sup_feat = con->msgr->supported_features; |
1947 | u64 req_feat = con->msgr->required_features; | 1950 | u64 req_feat = con->msgr->required_features; |
1948 | u64 server_feat = le64_to_cpu(con->in_reply.features); | 1951 | u64 server_feat = ceph_sanitize_features( |
1952 | le64_to_cpu(con->in_reply.features)); | ||
1949 | int ret; | 1953 | int ret; |
1950 | 1954 | ||
1951 | dout("process_connect on %p tag %d\n", con, (int)con->in_tag); | 1955 | dout("process_connect on %p tag %d\n", con, (int)con->in_tag); |
@@ -2853,8 +2857,8 @@ static void con_fault(struct ceph_connection *con) | |||
2853 | */ | 2857 | */ |
2854 | void ceph_messenger_init(struct ceph_messenger *msgr, | 2858 | void ceph_messenger_init(struct ceph_messenger *msgr, |
2855 | struct ceph_entity_addr *myaddr, | 2859 | struct ceph_entity_addr *myaddr, |
2856 | u32 supported_features, | 2860 | u64 supported_features, |
2857 | u32 required_features, | 2861 | u64 required_features, |
2858 | bool nocrc) | 2862 | bool nocrc) |
2859 | { | 2863 | { |
2860 | msgr->supported_features = supported_features; | 2864 | msgr->supported_features = supported_features; |
@@ -3126,15 +3130,8 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, | |||
3126 | INIT_LIST_HEAD(&m->data); | 3130 | INIT_LIST_HEAD(&m->data); |
3127 | 3131 | ||
3128 | /* front */ | 3132 | /* front */ |
3129 | m->front_max = front_len; | ||
3130 | if (front_len) { | 3133 | if (front_len) { |
3131 | if (front_len > PAGE_CACHE_SIZE) { | 3134 | m->front.iov_base = ceph_kvmalloc(front_len, flags); |
3132 | m->front.iov_base = __vmalloc(front_len, flags, | ||
3133 | PAGE_KERNEL); | ||
3134 | m->front_is_vmalloc = true; | ||
3135 | } else { | ||
3136 | m->front.iov_base = kmalloc(front_len, flags); | ||
3137 | } | ||
3138 | if (m->front.iov_base == NULL) { | 3135 | if (m->front.iov_base == NULL) { |
3139 | dout("ceph_msg_new can't allocate %d bytes\n", | 3136 | dout("ceph_msg_new can't allocate %d bytes\n", |
3140 | front_len); | 3137 | front_len); |
@@ -3143,7 +3140,7 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags, | |||
3143 | } else { | 3140 | } else { |
3144 | m->front.iov_base = NULL; | 3141 | m->front.iov_base = NULL; |
3145 | } | 3142 | } |
3146 | m->front.iov_len = front_len; | 3143 | m->front_alloc_len = m->front.iov_len = front_len; |
3147 | 3144 | ||
3148 | dout("ceph_msg_new %p front %d\n", m, front_len); | 3145 | dout("ceph_msg_new %p front %d\n", m, front_len); |
3149 | return m; | 3146 | return m; |
@@ -3256,10 +3253,7 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip) | |||
3256 | void ceph_msg_kfree(struct ceph_msg *m) | 3253 | void ceph_msg_kfree(struct ceph_msg *m) |
3257 | { | 3254 | { |
3258 | dout("msg_kfree %p\n", m); | 3255 | dout("msg_kfree %p\n", m); |
3259 | if (m->front_is_vmalloc) | 3256 | ceph_kvfree(m->front.iov_base); |
3260 | vfree(m->front.iov_base); | ||
3261 | else | ||
3262 | kfree(m->front.iov_base); | ||
3263 | kmem_cache_free(ceph_msg_cache, m); | 3257 | kmem_cache_free(ceph_msg_cache, m); |
3264 | } | 3258 | } |
3265 | 3259 | ||
@@ -3301,8 +3295,8 @@ EXPORT_SYMBOL(ceph_msg_last_put); | |||
3301 | 3295 | ||
3302 | void ceph_msg_dump(struct ceph_msg *msg) | 3296 | void ceph_msg_dump(struct ceph_msg *msg) |
3303 | { | 3297 | { |
3304 | pr_debug("msg_dump %p (front_max %d length %zd)\n", msg, | 3298 | pr_debug("msg_dump %p (front_alloc_len %d length %zd)\n", msg, |
3305 | msg->front_max, msg->data_length); | 3299 | msg->front_alloc_len, msg->data_length); |
3306 | print_hex_dump(KERN_DEBUG, "header: ", | 3300 | print_hex_dump(KERN_DEBUG, "header: ", |
3307 | DUMP_PREFIX_OFFSET, 16, 1, | 3301 | DUMP_PREFIX_OFFSET, 16, 1, |
3308 | &msg->hdr, sizeof(msg->hdr), true); | 3302 | &msg->hdr, sizeof(msg->hdr), true); |