libceph: fix pg_temp updates
Usually, we are adding pg_temp entries or removing them. Occasionally they update. In that case, osdmap_apply_incremental() was failing because the rbtree entry already exists. Fix by removing the existing entry before inserting a new one. Fixes http://tracker.newdream.net/issues/2446 Signed-off-by: Sage Weil <sage@inktank.com> Reviewed-by: Alex Elder <elder@inktank.com>
This commit is contained in:
@@ -883,8 +883,12 @@ struct ceph_osdmap *osdmap_apply_incremental(void **p, void *end,
|
|||||||
pglen = ceph_decode_32(p);
|
pglen = ceph_decode_32(p);
|
||||||
|
|
||||||
if (pglen) {
|
if (pglen) {
|
||||||
/* insert */
|
|
||||||
ceph_decode_need(p, end, pglen*sizeof(u32), bad);
|
ceph_decode_need(p, end, pglen*sizeof(u32), bad);
|
||||||
|
|
||||||
|
/* removing existing (if any) */
|
||||||
|
(void) __remove_pg_mapping(&map->pg_temp, pgid);
|
||||||
|
|
||||||
|
/* insert */
|
||||||
pg = kmalloc(sizeof(*pg) + sizeof(u32)*pglen, GFP_NOFS);
|
pg = kmalloc(sizeof(*pg) + sizeof(u32)*pglen, GFP_NOFS);
|
||||||
if (!pg) {
|
if (!pg) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
|
Reference in New Issue
Block a user