libceph: use alloc_pg_mapping() in __decode_pg_upmap_items()
authorIlya Dryomov <idryomov@gmail.com>
Fri, 7 Jul 2017 14:14:45 +0000 (16:14 +0200)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 17 Jul 2017 12:54:58 +0000 (14:54 +0200)
... otherwise we die in insert_pg_mapping(), which wants pg->node to be
empty, i.e. initialized with RB_CLEAR_NODE.

Fixes: 6f428df47dae ("libceph: pg_upmap[_items] infrastructure")
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/osdmap.c

index 48e0ff82bde2236910d7eea2a99d8041b1590937..64ae9f89773a1c44f84858eb7622599a81f25de6 100644 (file)
@@ -1400,7 +1400,7 @@ static struct ceph_pg_mapping *__decode_pg_upmap_items(void **p, void *end,
                return ERR_PTR(-EINVAL);
 
        ceph_decode_need(p, end, 2 * len * sizeof(u32), e_inval);
-       pg = kzalloc(sizeof(*pg) + 2 * len * sizeof(u32), GFP_NOIO);
+       pg = alloc_pg_mapping(2 * len * sizeof(u32));
        if (!pg)
                return ERR_PTR(-ENOMEM);