Skip to content

Commit

Permalink
ceph: do not feed bad device ids to crush
Browse files Browse the repository at this point in the history
Do not feed bad (large) device ids to CRUSH.

Signed-off-by: Sage Weil <sage@newdream.net>
  • Loading branch information
Sage Weil committed Dec 9, 2009
1 parent c2e552e commit 767ea5c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/ceph/osdmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,6 +868,11 @@ static int *calc_pg_raw(struct ceph_osdmap *osdmap, struct ceph_pg pgid,
ps = le16_to_cpu(pgid.ps);
preferred = (s16)le16_to_cpu(pgid.preferred);

/* don't forcefeed bad device ids to crush */
if (preferred >= osdmap->max_osd ||
preferred >= osdmap->crush->max_devices)
preferred = -1;

if (poolid >= osdmap->num_pools)
return NULL;
pool = &osdmap->pg_pool[poolid];
Expand Down

0 comments on commit 767ea5c

Please sign in to comment.