From: linbing Date: Fri, 26 May 2017 09:39:39 +0000 (+0800) Subject: mon: it's no need to get pg action_primary osd twice in pg scrub X-Git-Tag: v12.1.0~57^2~7^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=730781afec3fca97449f17879a241f4f411d1dd7;p=ceph.git mon: it's no need to get pg action_primary osd twice in pg scrub Signed-off-by: linbing --- diff --git a/src/mon/PGMonitor.cc b/src/mon/PGMonitor.cc index 151468a58970..2e7e08fe735c 100644 --- a/src/mon/PGMonitor.cc +++ b/src/mon/PGMonitor.cc @@ -1000,12 +1000,12 @@ bool PGMonitor::preprocess_command(MonOpRequestRef op) r = -ENOENT; goto reply; } - if (pg_map.pg_stat[pgid].acting_primary == -1) { + int osd = pg_map.pg_stat[pgid].acting_primary; + if (osd == -1) { ss << "pg " << pgid << " has no primary osd"; r = -EAGAIN; goto reply; } - int osd = pg_map.pg_stat[pgid].acting_primary; if (!mon->osdmon()->osdmap.is_up(osd)) { ss << "pg " << pgid << " primary osd." << osd << " not up"; r = -EAGAIN;