From: Joao Eduardo Luis Date: Mon, 11 Mar 2013 23:06:19 +0000 (+0000) Subject: mon: AuthMonitor: don't return global_id right away if we're increasing it X-Git-Tag: v0.59~14 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=436e5be950154fdbbd9e1cfaf4267be6159249d5;p=ceph.git mon: AuthMonitor: don't return global_id right away if we're increasing it This only happens on the Leader and leads to duplicate global_ids. Fixes: #4285 Signed-off-by: Joao Luis Reviewed-by: Sage Weil --- diff --git a/src/mon/AuthMonitor.cc b/src/mon/AuthMonitor.cc index da4fe92fb9a6..421024fd0458 100644 --- a/src/mon/AuthMonitor.cc +++ b/src/mon/AuthMonitor.cc @@ -328,7 +328,7 @@ uint64_t AuthMonitor::assign_global_id(MAuth *m, bool should_increase_max) uint64_t next_global_id = last_allocated_id + 1; - if (next_global_id < max_global_id) { + { int remainder = next_global_id % total_mon; if (remainder) remainder = total_mon - remainder; @@ -340,9 +340,12 @@ uint64_t AuthMonitor::assign_global_id(MAuth *m, bool should_increase_max) if (!mon->is_leader() || !should_increase_max) { return 0; } + bool return_next = (next_global_id == max_global_id); while (next_global_id >= max_global_id) { increase_max_global_id(); } + if (!return_next) + return 0; } last_allocated_id = next_global_id; @@ -433,6 +436,12 @@ bool AuthMonitor::prep_auth(MAuth *m, bool paxos_writable) if (!s->global_id) { s->global_id = assign_global_id(m, paxos_writable); if (!s->global_id) { + if (mon->is_leader() && paxos_writable) { + dout(10) << "increasing global id, waitlisting message" << dendl; + wait_for_active(new C_RetryMessage(this, m)); + goto done; + } + delete s->auth_handler; s->auth_handler = NULL; s->put();