if (!uclient) {
code = hpr_Initialize(&uclient);
- assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ if (!code)
+ assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ else
+ return code;
}
over = 0;
if (!uclient) {
code = hpr_Initialize(&uclient);
- assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ if (!code)
+ assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ else
+ return code;
}
for (i = 0; i < names->namelist_len; i++)
if (!uclient) {
code = hpr_Initialize(&uclient);
- assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ if (!code)
+ assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ else
+ return code;
}
code = ubik_PR_IDToName(uclient, 0, ids, names);
if (!uclient) {
code = hpr_Initialize(&uclient);
- assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ if (!code)
+ assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
+ else
+ return code;
}
over = 0;
if (!(held[count] = h_Held_r(host)))
h_Hold_r(host);
}
- assert(count == hostCount);
+ if (count != hostCount) {
+ ViceLog(0, ("h_Enumerate found %d of %d hosts\n", count, hostCount));
+ }
+ assert(count <= hostCount);
H_UNLOCK;
for (i = 0; i < count; i++) {
held[i] = (*proc) (list[i], held[i], param);
* of the caller matches the identity in the host structure.
*/
if ((host->hostFlags & HWHO_INPROGRESS) &&
- h_threadquota(host->lock.num_waiting))
+ h_threadquota(host->lock.num_waiting)) {
+ if (!held)
+ h_Release_r(host);
return 0;
+ }
h_Lock_r(host);
if (!(host->hostFlags & ALTADDR)) {
host->hostFlags &= ~HWHO_INPROGRESS;
cb_conn=NULL;
H_LOCK;
if ((code == RXGEN_OPCODE) ||
- (afs_uuid_equal(&interf.uuid, &nulluuid))) {
+ ((code == 0) && (afs_uuid_equal(&interf.uuid, &nulluuid)))) {
identP = (struct Identity *)malloc(sizeof(struct Identity));
if (!identP) {
ViceLog(0, ("Failed malloc in h_GetHost_r\n"));
host->interface ? uuid2 : "no_uuid"));
/* The host in the cache is not the host for this connection */
+ h_Lock_r(host);
host->hostFlags |= HOSTDELETED;
host->hostFlags &= ~HWHO_INPROGRESS;
h_Unlock_r(host);
cb_conn=NULL;
H_LOCK;
if ((code == RXGEN_OPCODE) ||
- afs_uuid_equal(&interf.uuid, &nulluuid)) {
+ ((code == 0) && (afs_uuid_equal(&interf.uuid, &nulluuid)))) {
if (!identP)
identP =
(struct Identity *)malloc(sizeof(struct Identity));
struct rx_connection *cb_conn = NULL;
int code;
+#ifdef AFS_DEMAND_ATTACH_FS
+ /* kill the checkhost lwp ASAP during shutdown */
+ FS_STATE_RDLOCK;
+ if (fs_state.mode == FS_MODE_SHUTDOWN) {
+ FS_STATE_UNLOCK;
+ return H_ENUMERATE_BAIL(held);
+ }
+ FS_STATE_UNLOCK;
+#endif
+
/* Host is held by h_Enumerate_r */
for (client = host->FirstClient; client; client = client->next) {
if (client->refCount == 0 && client->LastCall < clientdeletetime) {