From: Andrew Tridgell Date: Thu, 26 Apr 2007 09:13:49 +0000 (+0200) Subject: merge from ronnie X-Git-Tag: tevent-0.9.20~348^2~2845 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c1a4b3c6871f3fd915f5e45171801aae5e50e033;p=thirdparty%2Fsamba.git merge from ronnie (This used to be ctdb commit 37ef65737571a4290a150c28cf2b0a6b221253fd) --- c1a4b3c6871f3fd915f5e45171801aae5e50e033 diff --cc ctdb/common/ctdb_call.c index 40bfa1660d1,99a27fbf80c..86da20ea2e8 --- a/ctdb/common/ctdb_call.c +++ b/ctdb/common/ctdb_call.c @@@ -601,15 -629,20 +629,23 @@@ void ctdb_reply_redirect(struct ctdb_co struct ctdb_reply_redirect *c = (struct ctdb_reply_redirect *)hdr; struct ctdb_call_state *state; - state = idr_find_type(ctdb->idr, hdr->reqid, struct ctdb_call_state); - if (state == NULL) return; + state = ctdb_reqid_find(ctdb, hdr->reqid, struct ctdb_call_state); + if (state == NULL) { + return; + } + + if (hdr->reqid != state->reqid) { + /* we found a record but it was the wrong one */ + DEBUG(0, ("Dropped orphaned dmaster reply with reqid:%d\n",hdr->reqid)); + return; + } /* don't allow for too many redirects */ - if (state->redirect_count++ == CTDB_MAX_REDIRECT) { + if ((++state->redirect_count) % CTDB_MAX_REDIRECT == 0) { c->dmaster = ctdb_lmaster(ctdb, &state->call.key); + if (state->redirect_count > ctdb->status.max_redirect_count) { + ctdb->status.max_redirect_count = state->redirect_count; + } } /* send it off again */