Skip to content

Commit

Permalink
crush: assume weight_set != null imples weight_set_size > 0
Browse files Browse the repository at this point in the history
Reflects ceph.git commit 5e8fa3e06b68fae1582c9230a3a8d1abc6146286.

Signed-off-by: Ilya Dryomov <[email protected]>
Reviewed-by: Sage Weil <[email protected]>
  • Loading branch information
idryomov committed Aug 1, 2017
1 parent e17e896 commit c7ed1a4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion net/ceph/crush/mapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ static __u32 *get_choose_arg_weights(const struct crush_bucket_straw2 *bucket,
const struct crush_choose_arg *arg,
int position)
{
if (!arg || !arg->weight_set || arg->weight_set_size == 0)
if (!arg || !arg->weight_set)
return bucket->item_weights;

if (position >= arg->weight_set_size)
Expand Down
4 changes: 4 additions & 0 deletions net/ceph/osdmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,10 @@ static int decode_choose_args(void **p, void *end, struct crush_map *c)
ret = decode_choose_arg(p, end, arg);
if (ret)
goto fail;

if (arg->ids_size &&
arg->ids_size != c->buckets[bucket_index]->size)
goto e_inval;
}

insert_choose_arg_map(&c->choose_args, arg_map);
Expand Down

0 comments on commit c7ed1a4

Please sign in to comment.