]> Pileus Git - ~andy/linux/blobdiff - net/ceph/messenger.c
Merge branch 'for-3.14/core' of git://git.kernel.dk/linux-block
[~andy/linux] / net / ceph / messenger.c
index 18c039b95c22459f8d669ee2598c411c1b615141..0e478a0f4204b72ed19ae49c349d632cda009e02 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/dns_resolver.h>
 #include <net/tcp.h>
 
+#include <linux/ceph/ceph_features.h>
 #include <linux/ceph/libceph.h>
 #include <linux/ceph/messenger.h>
 #include <linux/ceph/decode.h>
@@ -1856,7 +1857,9 @@ int ceph_parse_ips(const char *c, const char *end,
                                port = (port * 10) + (*p - '0');
                                p++;
                        }
-                       if (port > 65535 || port == 0)
+                       if (port == 0)
+                               port = CEPH_MON_PORT;
+                       else if (port > 65535)
                                goto bad;
                } else {
                        port = CEPH_MON_PORT;
@@ -1936,7 +1939,8 @@ static int process_connect(struct ceph_connection *con)
 {
        u64 sup_feat = con->msgr->supported_features;
        u64 req_feat = con->msgr->required_features;
-       u64 server_feat = le64_to_cpu(con->in_reply.features);
+       u64 server_feat = ceph_sanitize_features(
+                               le64_to_cpu(con->in_reply.features));
        int ret;
 
        dout("process_connect on %p tag %d\n", con, (int)con->in_tag);
@@ -2844,8 +2848,8 @@ static void con_fault(struct ceph_connection *con)
  */
 void ceph_messenger_init(struct ceph_messenger *msgr,
                        struct ceph_entity_addr *myaddr,
-                       u32 supported_features,
-                       u32 required_features,
+                       u64 supported_features,
+                       u64 required_features,
                        bool nocrc)
 {
        msgr->supported_features = supported_features;
@@ -3117,15 +3121,8 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
        INIT_LIST_HEAD(&m->data);
 
        /* front */
-       m->front_max = front_len;
        if (front_len) {
-               if (front_len > PAGE_CACHE_SIZE) {
-                       m->front.iov_base = __vmalloc(front_len, flags,
-                                                     PAGE_KERNEL);
-                       m->front_is_vmalloc = true;
-               } else {
-                       m->front.iov_base = kmalloc(front_len, flags);
-               }
+               m->front.iov_base = ceph_kvmalloc(front_len, flags);
                if (m->front.iov_base == NULL) {
                        dout("ceph_msg_new can't allocate %d bytes\n",
                             front_len);
@@ -3134,7 +3131,7 @@ struct ceph_msg *ceph_msg_new(int type, int front_len, gfp_t flags,
        } else {
                m->front.iov_base = NULL;
        }
-       m->front.iov_len = front_len;
+       m->front_alloc_len = m->front.iov_len = front_len;
 
        dout("ceph_msg_new %p front %d\n", m, front_len);
        return m;
@@ -3247,10 +3244,7 @@ static int ceph_con_in_msg_alloc(struct ceph_connection *con, int *skip)
 void ceph_msg_kfree(struct ceph_msg *m)
 {
        dout("msg_kfree %p\n", m);
-       if (m->front_is_vmalloc)
-               vfree(m->front.iov_base);
-       else
-               kfree(m->front.iov_base);
+       ceph_kvfree(m->front.iov_base);
        kmem_cache_free(ceph_msg_cache, m);
 }
 
@@ -3292,8 +3286,8 @@ EXPORT_SYMBOL(ceph_msg_last_put);
 
 void ceph_msg_dump(struct ceph_msg *msg)
 {
-       pr_debug("msg_dump %p (front_max %d length %zd)\n", msg,
-                msg->front_max, msg->data_length);
+       pr_debug("msg_dump %p (front_alloc_len %d length %zd)\n", msg,
+                msg->front_alloc_len, msg->data_length);
        print_hex_dump(KERN_DEBUG, "header: ",
                       DUMP_PREFIX_OFFSET, 16, 1,
                       &msg->hdr, sizeof(msg->hdr), true);