diff --git a/src/osd/osd_primary.cpp b/src/osd/osd_primary.cpp index 911a9325..761e965a 100644 --- a/src/osd/osd_primary.cpp +++ b/src/osd/osd_primary.cpp @@ -35,7 +35,15 @@ bool osd_t::prepare_primary_rw(osd_op_t *cur_op) // oid.stripe = starting offset of the parity stripe .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 }); if (pg_it == pgs.end() || pg_it->second.state == PG_OFFLINE) {