Windows: use cm_ServerEqual() in cm_Analyze()

In cm_Analyze() when processing VNOVOL, VMOVED or VOFFLINE errors
do not use pointer equivalence as the test to determine if a
server is affected by the error.  Use cm_ServerEqual() instead.

Fix cm_ServerEqual() to work even when both cm_server_t objects
are not UUID aware.

Change-Id: Icb83ba77984075216a44cdeba689bc05e98ed92a
Reviewed-on: http://gerrit.openafs.org/3659
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
This commit is contained in:
Jeffrey Altman 2011-01-14 00:22:39 -05:00 committed by Jeffrey Altman
parent 7c0d4b331e
commit f25cbdf09f
2 changed files with 13 additions and 4 deletions

View File

@ -528,7 +528,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
switch ( errorCode ) {
case VNOVOL:
msgID = MSG_SERVER_REPORTS_VNOVOL;
format = "Server %s reported volume %d in cell %s as not attached (does not exist).";
format = "Server %s reported volume %d in cell %s as not attached (may have been moved or deleted).";
break;
case VMOVED:
msgID = MSG_SERVER_REPORTS_VMOVED;
@ -554,7 +554,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
if (fidp) { /* File Server query */
if (serverp) {
/* Log server being offline for this volume */
/* Log server being unavailable for this volume */
sprintf(addr, "%d.%d.%d.%d",
((serverp->addr.sin_addr.s_addr & 0xff)),
((serverp->addr.sin_addr.s_addr & 0xff00)>> 8),
@ -622,7 +622,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp,
((tsrp->server->addr.sin_addr.s_addr & 0xff0000)>> 16),
((tsrp->server->addr.sin_addr.s_addr & 0xff000000)>> 24));
if (tsrp->server == serverp) {
if (cm_ServerEqual(tsrp->server, serverp)) {
/* REDIRECT */
if (errorCode == VMOVED || errorCode == VNOVOL) {
osi_Log2(afsd_logp, "volume %d not present on server %s",

View File

@ -1358,7 +1358,16 @@ int cm_ServerEqual(cm_server_t *srv1, cm_server_t *srv2)
/* Both support UUID */
if (UuidEqual((UUID *)&srv1->uuid, (UUID *)&srv2->uuid, &status))
return 1;
}
} else {
if (srv1->flags & CM_SERVERFLAG_UUID)
return 0;
/* Neither support UUID so perform an addr/port comparison */
if ( srv1->addr.sin_family == srv2->addr.sin_family &&
srv1->addr.sin_addr.s_addr == srv2->addr.sin_addr.s_addr &&
srv1->addr.sin_port == srv2->addr.sin_port )
return 1;
}
return 0;
}