static int
ContactQuorum_iterate(struct ubik_trans *atrans, int aflags, struct ubik_server **ts,
struct rx_connection **conn, afs_int32 *rcode,
- afs_int32 *okcalls, afs_int32 code)
+ afs_int32 *okcalls, afs_int32 code, const char *procname)
{
if (!*ts) {
/* Initial call - start iterating over servers */
Quorum_EndIO(atrans, *conn);
*conn = NULL;
if (code) { /* failure */
+ char hoststr[16];
+
*rcode = code;
UBIK_BEACON_LOCK;
(*ts)->up = 0; /* mark as down now; beacons will no longer be sent */
UBIK_BEACON_UNLOCK;
(*ts)->currentDB = 0;
urecovery_LostServer(*ts); /* tell recovery to try to resend dbase later */
+ ViceLog(0, ("Server %s is marked down due to %s code %d\n",
+ afs_inet_ntoa_r((*ts)->addr[0], hoststr), procname, *rcode));
} else { /* success */
if (!(*ts)->isClone)
(*okcalls)++; /* count up how many worked */
*/
static afs_int32
ContactQuorum_NoArguments(afs_int32 (*proc)(struct rx_connection *, ubik_tid *),
- struct ubik_trans *atrans, int aflags)
+ struct ubik_trans *atrans, int aflags, const char *procname)
{
struct ubik_server *ts = NULL;
afs_int32 code = 0, rcode, okcalls;
struct rx_connection *conn;
int done;
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
while (!done) {
if (conn)
code = (*proc)(conn, &atrans->tid);
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
}
return ContactQuorum_rcode(okcalls, rcode);
}
afs_int32 code = 0, rcode, okcalls;
struct rx_connection *conn;
int done;
+ char *procname = "DISK_Lock";
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
while (!done) {
if (conn)
code = DISK_Lock(conn, &atrans->tid, file, position, length, type);
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
}
return ContactQuorum_rcode(okcalls, rcode);
}
afs_int32 code = 0, rcode, okcalls;
struct rx_connection *conn;
int done;
+ char *procname = "DISK_Truncate";
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
while (!done) {
if (conn)
code = DISK_Truncate(conn, &atrans->tid, file, length);
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
}
return ContactQuorum_rcode(okcalls, rcode);
}
afs_int32 code = 0, rcode, okcalls;
struct rx_connection *conn;
int done;
+ char *procname = "DISK_WriteV";
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
while (!done) {
if (conn) {
+ procname = "DISK_WriteV"; /* in case previous fallback to DISK_Write */
code = DISK_WriteV(conn, &atrans->tid, io_vector, io_buffer);
if ((code <= -450) && (code > -500)) {
/* An RPC interface mismatch (as defined in comerr/error_msg.c).
bulkdata tcbs;
afs_int32 i, offset;
+ procname = "DISK_Write"; /* for accurate error msg, if any */
for (i = 0, offset = 0; i < io_vector->iovec_wrt_len; i++) {
/* Sanity check for going off end of buffer */
if ((offset + iovec[i].length) > io_buffer->iovec_buf_len) {
}
}
}
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
}
return ContactQuorum_rcode(okcalls, rcode);
}
afs_int32 code = 0, rcode, okcalls;
struct rx_connection *conn;
int done;
+ char *procname = "DISK_SetVersion";
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
while (!done) {
if (conn)
code = DISK_SetVersion(conn, &atrans->tid, OldVersion, NewVersion);
- done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code);
+ done = ContactQuorum_iterate(atrans, aflags, &ts, &conn, &rcode, &okcalls, code, procname);
}
return ContactQuorum_rcode(okcalls, rcode);
}
if (transMode == UBIK_WRITETRANS) {
/* next try to start transaction on appropriate number of machines */
- code = ContactQuorum_NoArguments(DISK_Begin, tt, CCheckSyncAdvertised);
+ code = ContactQuorum_NoArguments(DISK_Begin, tt, CCheckSyncAdvertised, "DISK_Begin");
if (code) {
/* we must abort the operation */
udisk_abort(tt);
- ContactQuorum_NoArguments(DISK_Abort, tt, 0); /* force aborts to the others */
+ /* force aborts to the others */
+ ContactQuorum_NoArguments(DISK_Abort, tt, 0, "DISK_Abort");
udisk_end(tt);
DBRELE(dbase);
return code;
}
/* now it is safe to try remote abort */
- code = ContactQuorum_NoArguments(DISK_Abort, transPtr, 0);
+ code = ContactQuorum_NoArguments(DISK_Abort, transPtr, 0, "DISK_Abort");
code2 = udisk_abort(transPtr);
udisk_end(transPtr);
DBRELE(dbase);
ReleaseWriteLock(&dbase->cache_lock);
- code = ContactQuorum_NoArguments(DISK_Commit, transPtr, CStampVersion);
+ code = ContactQuorum_NoArguments(DISK_Commit, transPtr, CStampVersion, "DISK_Commit");
} else {
memset(&dbase->cachedVersion, 0, sizeof(struct ubik_version));
* we lose. If we contact a majority of sites, then we won't be here: contacting
* a majority guarantees commit, since it guarantees that one dude will be a
* member of the next quorum. */
- ContactQuorum_NoArguments(DISK_ReleaseLocks, transPtr, 0);
+ ContactQuorum_NoArguments(DISK_ReleaseLocks, transPtr, 0, "DISK_ReleaseLocks");
udisk_end(transPtr);
DBRELE(dbase);
goto error;
* The transaction is committed anyway, since we succeeded in contacting a quorum
* at the start (when invoking the DiskCommit function).
*/
- ContactQuorum_NoArguments(DISK_ReleaseLocks, transPtr, 0);
+ ContactQuorum_NoArguments(DISK_ReleaseLocks, transPtr, 0, "DISK_ReleaseLocks");
success:
udisk_end(transPtr);
&transPtr->iovec_data);
if (code) {
udisk_abort(transPtr);
- ContactQuorum_NoArguments(DISK_Abort, transPtr, 0); /* force aborts to the others */
+ /* force aborts to the others */
+ ContactQuorum_NoArguments(DISK_Abort, transPtr, 0, "DISK_Abort");
transPtr->iovec_info.iovec_wrt_len = 0;
transPtr->iovec_data.iovec_buf_len = 0;
ERROR_EXIT(code);
if (code) {
/* we must abort the operation */
udisk_abort(transPtr);
- ContactQuorum_NoArguments(DISK_Abort, transPtr, 0); /* force aborts to the others */
+ /* force aborts to the others */
+ ContactQuorum_NoArguments(DISK_Abort, transPtr, 0, "DISK_Abort");
ERROR_EXIT(code);
}
if (code) {
/* we must abort the operation */
udisk_abort(atrans);
- ContactQuorum_NoArguments(DISK_Abort, atrans, 0); /* force aborts to the others */
+ /* force aborts to the others */
+ ContactQuorum_NoArguments(DISK_Abort, atrans, 0, "DISK_Abort");
ERROR_EXIT(code);
}
}