osd: avoid map_lock for scrub_map reply

Using osd->osdmap->epoch without map_lock is dangerous.  We can avoid it
entirely by replying on the same connection as the request.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
This commit is contained in:
Sage Weil 2011-02-08 08:41:14 -08:00
parent 416292027d
commit a948aa1180

View File

@ -3121,17 +3121,12 @@ void PG::replica_scrub(MOSDRepScrub *msg)
eversion_t v;
osd_reqid_t reqid;
MOSDSubOp *subop = new MOSDSubOp(reqid, info.pgid, poid, false, 0,
osd->osdmap->get_epoch(), osd->get_tid(), v);
msg->map_epoch, osd->get_tid(), v);
::encode(map, subop->get_data());
subop->ops = scrub;
unlock();
osd->map_lock.get_read();
lock();
osd->cluster_messenger->send_message(subop, msg->get_connection());
osd->cluster_messenger->send_message(subop, osd->osdmap->get_cluster_inst(acting[0]));
osd->map_lock.put_read();
msg->put();
}