Permalink
Browse files

osdmap: fix addr dedup check

Compare *every* address for a match, or else note that it is (or might be)
different.  Previously, we falsely took diff==0 to mean that all addrs
were definitely equal, which was not necessarily the case.

Signed-off-by: Sage Weil <sage.weil@dreamhost.com>
  • Loading branch information...
1 parent 10c616a commit 4274fd05d4ced111c18187fe7814912dd3f8114e @liewegas liewegas committed Apr 28, 2012
Showing with 13 additions and 17 deletions.
  1. +13 −17 src/osd/OSDMap.cc
View
30 src/osd/OSDMap.cc
@@ -573,25 +573,21 @@ void OSDMap::dedup(const OSDMap *o, OSDMap *n)
if (o->max_osd != n->max_osd)
diff++;
for (int i = 0; i < o->max_osd && i < n->max_osd; i++) {
- if ((o->epoch < n->epoch && n->osd_info[i].up_from <= o->epoch) ||
- (o->epoch > n->epoch && o->osd_info[i].up_from <= n->epoch)) {
- // same up interval, all should match... but let's be paranoid!
- if (n->osd_addrs->client_addr[i] && o->osd_addrs->client_addr[i] &&
- *n->osd_addrs->client_addr[i] == *o->osd_addrs->client_addr[i])
- n->osd_addrs->client_addr[i] = o->osd_addrs->client_addr[i];
- if (n->osd_addrs->client_addr[i] && o->osd_addrs->client_addr[i] &&
- *n->osd_addrs->cluster_addr[i] == *o->osd_addrs->cluster_addr[i])
- n->osd_addrs->cluster_addr[i] = o->osd_addrs->cluster_addr[i];
- if (n->osd_addrs->client_addr[i] && o->osd_addrs->client_addr[i] &&
- *n->osd_addrs->hb_addr[i] == *o->osd_addrs->hb_addr[i])
- n->osd_addrs->hb_addr[i] = o->osd_addrs->hb_addr[i];
- } else if (n->osd_addrs->client_addr[i] && o->osd_addrs->client_addr[i] &&
- *n->osd_addrs->client_addr[i] == *o->osd_addrs->client_addr[i]) {
- // client addr matches
+ if ( n->osd_addrs->client_addr[i] && o->osd_addrs->client_addr[i] &&
+ *n->osd_addrs->client_addr[i] == *o->osd_addrs->client_addr[i])
n->osd_addrs->client_addr[i] = o->osd_addrs->client_addr[i];
- } else {
+ else
+ diff++;
+ if ( n->osd_addrs->cluster_addr[i] && o->osd_addrs->cluster_addr[i] &&
+ *n->osd_addrs->cluster_addr[i] == *o->osd_addrs->cluster_addr[i])
+ n->osd_addrs->cluster_addr[i] = o->osd_addrs->cluster_addr[i];
+ else
+ diff++;
+ if ( n->osd_addrs->hb_addr[i] && o->osd_addrs->hb_addr[i] &&
+ *n->osd_addrs->hb_addr[i] == *o->osd_addrs->hb_addr[i])
+ n->osd_addrs->hb_addr[i] = o->osd_addrs->hb_addr[i];
+ else
diff++;
- }
}
if (diff == 0) {
// zoinks, no differences at all!

0 comments on commit 4274fd0

Please sign in to comment.