Fix possible FPE in osd_primary
This commit is contained in:
@@ -35,7 +35,15 @@ bool osd_t::prepare_primary_rw(osd_op_t *cur_op)
|
|||||||
// oid.stripe = starting offset of the parity stripe
|
// oid.stripe = starting offset of the parity stripe
|
||||||
.stripe = (cur_op->req.rw.offset/pg_block_size)*pg_block_size,
|
.stripe = (cur_op->req.rw.offset/pg_block_size)*pg_block_size,
|
||||||
};
|
};
|
||||||
pg_num_t pg_num = (oid.stripe/pool_cfg.pg_stripe_size) % pg_counts[pool_id] + 1; // like map_to_pg()
|
// FIXME: pg_counts should be stored in pool_config, not in a separate map
|
||||||
|
auto pg_count = pg_counts[pool_id];
|
||||||
|
if (!pg_count)
|
||||||
|
{
|
||||||
|
// Pool config is not loaded yet
|
||||||
|
finish_op(cur_op, -EPIPE);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
pg_num_t pg_num = (oid.stripe/pool_cfg.pg_stripe_size) % pg_count + 1; // like map_to_pg()
|
||||||
auto pg_it = pgs.find({ .pool_id = pool_id, .pg_num = pg_num });
|
auto pg_it = pgs.find({ .pool_id = pool_id, .pg_num = pg_num });
|
||||||
if (pg_it == pgs.end() || pg_it->second.state == PG_OFFLINE)
|
if (pg_it == pgs.end() || pg_it->second.state == PG_OFFLINE)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user