#include "viced_prototypes.h"
#include "viced.h"
#include "host.h"
+#include "callback.h"
#include <afs/unified_afs.h>
#include <afs/audit.h>
#include <afs/afsutil.h>
/*
* Externals used by the xstat code.
*/
-extern int VolumeCacheSize, VolumeGets, VolumeReplacements;
+extern VolPkgStats VStats;
extern int CEs, CEBlocks;
extern int HTs, HTBlocks;
*/
static int
CallPreamble(register struct rx_call *acall, int activecall,
- struct rx_connection **tconn)
+ struct rx_connection **tconn, struct host **ahostp)
{
struct host *thost;
struct client *tclient;
int retry_flag = 1;
int code = 0;
char hoststr[16], hoststr2[16];
+ struct ubik_client *uclient;
+
if (!tconn) {
ViceLog(0, ("CallPreamble: unexpected null tconn!\n"));
return -1;
H_LOCK;
retry:
tclient = h_FindClient_r(*tconn);
+ thost = tclient->host;
if (tclient->prfail == 1) { /* couldn't get the CPS */
if (!retry_flag) {
h_ReleaseClient_r(tclient);
+ h_Release_r(thost);
ViceLog(0, ("CallPreamble: Couldn't get CPS. Fail\n"));
H_UNLOCK;
return -1001;
/* Take down the old connection and re-read the key file */
ViceLog(0,
("CallPreamble: Couldn't get CPS. Reconnect to ptserver\n"));
+#ifdef AFS_PTHREAD_ENV
+ uclient = (struct ubik_client *)pthread_getspecific(viced_uclient_key);
+
+ /* Is it still necessary to drop this? We hit the net, we should... */
H_UNLOCK;
- code = pr_Initialize(2, AFSDIR_SERVER_ETC_DIRPATH, 0);
+ if (uclient)
+ hpr_End(uclient);
+ code = hpr_Initialize(&uclient);
+
+ assert(pthread_setspecific(viced_uclient_key, (void *)uclient) == 0);
H_LOCK;
+#else
+ code = pr_Initialize(2, AFSDIR_SERVER_ETC_DIRPATH, 0);
+#endif
if (code) {
h_ReleaseClient_r(tclient);
+ h_Release_r(thost);
H_UNLOCK;
ViceLog(0, ("CallPreamble: couldn't reconnect to ptserver\n"));
return -1001;
tclient->prfail = 2; /* Means re-eval client's cps */
h_ReleaseClient_r(tclient);
+ h_Release_r(thost);
goto retry;
}
- thost = tclient->host;
tclient->LastCall = thost->LastCall = FT_ApproxTime();
if (activecall) /* For all but "GetTime", "GetStats", and "GetCaps" calls */
thost->ActiveCall = thost->LastCall;
if (BreakDelayedCallBacks_r(thost)) {
ViceLog(0,
("BreakDelayedCallbacks FAILED for host %s:%d which IS UP. Connection from %s:%d. Possible network or routing failure.\n",
- afs_inet_ntoa_r(thost->host, hoststr), ntohs(thost->port), afs_inet_ntoa_r(rxr_HostOf(*tconn), hoststr2),
+ afs_inet_ntoa_r(thost->host, hoststr), ntohs(thost->port), rxr_AddrStringOf(*tconn),
ntohs(rxr_PortOf(*tconn))));
if (MultiProbeAlternateAddress_r(thost)) {
ViceLog(0,
if (BreakDelayedCallBacks_r(thost)) {
ViceLog(0,
("BreakDelayedCallbacks FAILED AGAIN for host %s:%d which IS UP. Connection from %s:%d. Possible network or routing failure.\n",
- afs_inet_ntoa_r(thost->host, hoststr), ntohs(thost->port), afs_inet_ntoa_r(rxr_HostOf(*tconn), hoststr2),
+ afs_inet_ntoa_r(thost->host, hoststr), ntohs(thost->port), rxr_AddrStringOf(*tconn),
ntohs(rxr_PortOf(*tconn))));
code = -1;
}
h_ReleaseClient_r(tclient);
h_Unlock_r(thost);
H_UNLOCK;
+ *ahostp = thost;
return code;
} /*CallPreamble */
static afs_int32
-CallPostamble(register struct rx_connection *aconn, afs_int32 ret)
+CallPostamble(register struct rx_connection *aconn, afs_int32 ret,
+ struct host *ahost)
{
struct host *thost;
struct client *tclient;
int translate = 0;
+ int held;
H_LOCK;
tclient = h_FindClient_r(aconn);
if (thost->hostFlags & HERRORTRANS)
translate = 1;
h_ReleaseClient_r(tclient);
- h_Release_r(thost);
+ held = h_Held_r(thost);
+ if (held)
+ h_Release_r(thost);
+ if (ahost != thost) {
+ char hoststr[16], hoststr2[16];
+ ViceLog(0, ("CallPostamble: ahost %s:%d (%x) != thost %s:%d (%x)\n",
+ afs_inet_ntoa_r(thost->host, hoststr), ntohs(thost->port),
+ ahost,
+ afs_inet_ntoa_r(thost->host, hoststr2), ntohs(thost->port),
+ thost));
+ h_Release_r(ahost);
+ }
H_UNLOCK;
return (translate ? sys_error_to_et(ret) : ret);
} /*CallPostamble */
CheckVnode(AFSFid * fid, Volume ** volptr, Vnode ** vptr, int lock)
{
int fileCode = 0;
- int errorCode = -1;
+ afs_int32 local_errorCode, errorCode = -1;
static struct timeval restartedat = { 0, 0 };
if (fid->Volume == 0 || fid->Vnode == 0) /* not: || fid->Unique == 0) */
while (1) {
errorCode = 0;
- *volptr = VGetVolume(&errorCode, (afs_int32) fid->Volume);
+ *volptr = VGetVolume(&local_errorCode, &errorCode, (afs_int32) fid->Volume);
if (!errorCode) {
assert(*volptr);
break;
}
}
}
- /* allow read operations on busy volume */
- else if (errorCode == VBUSY && lock == READ_LOCK) {
+ /* allow read operations on busy volume.
+ * must check local_errorCode because demand attach fs
+ * can have local_errorCode == VSALVAGING, errorCode == VBUSY */
+ else if (local_errorCode == VBUSY && lock == READ_LOCK) {
errorCode = 0;
break;
} else if (errorCode)
#endif /* AFS_PTHREAD_ENV */
}
- if (client->host->hcps.prlist_len && !client->host->hcps.prlist_val) {
+ if (!client->host->hcps.prlist_len || !client->host->hcps.prlist_val) {
+ char hoststr[16];
ViceLog(0,
- ("CheckRights: len=%u, for host=0x%x\n",
- client->host->hcps.prlist_len, client->host->host));
+ ("CheckRights: len=%u, for host=%s:%d\n",
+ client->host->hcps.prlist_len,
+ afs_inet_ntoa_r(client->host->host, hoststr),
+ ntohs(client->host->port)));
} else
acl_CheckRights(ACL, &client->host->hcps, &hrights);
H_UNLOCK;
wrlen, errno));
#ifdef FAST_RESTART /* if running in no-salvage, don't core the server */
ViceLog(0, ("CopyOnWrite failed: taking volume offline\n"));
+#elif defined(AFS_DEMAND_ATTACH_FS)
+ ViceLog(0, ("CopyOnWrite failed: requesting salvage\n"));
#else /* Avoid further corruption and try to get a core. */
assert(0);
#endif
* SAFS_ReleaseLock)
*/
static afs_int32
-HandleLocking(Vnode * targetptr, afs_int32 rights, ViceLockType LockingType)
+HandleLocking(Vnode * targetptr, struct client *client, afs_int32 rights, ViceLockType LockingType)
{
int Time; /* Used for time */
int writeVnode = targetptr->changed_oldTime; /* save original status */
- /* Does the caller has Lock priviledges; root extends locks, however */
- if (LockingType != LockExtend && !(rights & PRSFS_LOCK))
- return (EACCES);
targetptr->changed_oldTime = 1; /* locking doesn't affect any time stamp */
Time = FT_ApproxTime();
switch (LockingType) {
0;
Time += AFS_LOCKWAIT;
if (LockingType == LockRead) {
+ if ( !(rights & PRSFS_LOCK) )
+ return(EACCES);
+
if (targetptr->disk.lock.lockCount >= 0) {
++(targetptr->disk.lock.lockCount);
targetptr->disk.lock.lockTime = Time;
} else
return (EAGAIN);
- } else {
+ } else if (LockingType == LockWrite) {
+ if ( !(rights & PRSFS_WRITE) &&
+ !(OWNSp(client, targetptr) && (rights & PRSFS_INSERT)) )
+ return(EACCES);
+
if (targetptr->disk.lock.lockCount == 0) {
targetptr->disk.lock.lockCount = -1;
targetptr->disk.lock.lockTime = Time;
Volume *volptr = 0; /* pointer to the volume */
struct client *client = 0; /* pointer to the client data */
struct rx_connection *tcon; /* the connection we're part of */
+ struct host *thost;
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client = NULL; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
struct fs_stats_xferData *xferP; /* Ptr to this op's byte size struct */
FS_LOCK;
AFSCallStats.FetchData++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_FetchData;
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(5,
("SRXAFS_FetchData, Fid = %u.%u.%u, Host %s:%d, Id %d\n",
- Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr),
+ Fid->Volume, Fid->Vnode, Fid->Unique, rxr_AddrStringOf(tcon),
ntohs(rxr_PortOf(tcon)), t_client->ViceId));
/*
* Get volume/vnode for the fetched file; caller's access rights to
(void)PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0,
volptr, &client);
ViceLog(2, ("SRXAFS_FetchData returns %d\n", errorCode));
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
struct client *client = 0; /* pointer to the client data */
afs_int32 rights, anyrights; /* rights for this and any user */
struct rx_connection *tcon = rx_ConnectionOf(acall);
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */
FS_LOCK;
AFSCallStats.FetchACL++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_FetchACL;
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(5,
("SAFS_FetchACL, Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume,
- Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr),
+ Fid->Vnode, Fid->Unique, rxr_AddrStringOf(tcon),
ntohs(rxr_PortOf(tcon)), t_client->ViceId));
AccessList->AFSOpaque_len = 0;
ViceLog(2,
("SAFS_FetchACL returns %d (ACL=%s)\n", errorCode,
AccessList->AFSOpaque_val));
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
struct client *client = 0; /* pointer to the client data */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client = NULL; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_FetchStatus, Fid = %u.%u.%u, Host %s:%d, Id %d\n",
- Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr),
+ Fid->Volume, Fid->Vnode, Fid->Unique, rxr_AddrStringOf(tcon),
ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.FetchStatus++, AFSCallStats.TotalCalls++;
afs_int32 rights, anyrights; /* rights for this and any user */
register struct AFSFid *tfid; /* file id we're dealing with now */
struct rx_connection *tcon = rx_ConnectionOf(acall);
+ struct host *thost;
struct client *t_client = NULL; /* tmp pointer to the client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
}
CallBacks->AFSCBs_len = nfiles;
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_BulkStatus;
tfid = Fids->AFSCBFids_val;
/* Update and store volume/vnode and parent vnodes back */
(void)PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0,
volptr, &client);
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
afs_int32 rights, anyrights; /* rights for this and any user */
register struct AFSFid *tfid; /* file id we're dealing with now */
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
AFSFetchStatus *tstatus;
#if FS_STATS_DETAILED
}
CallBacks->AFSCBs_len = nfiles;
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon))) {
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost))) {
goto Bad_InlineBulkStatus;
}
/* Update and store volume/vnode and parent vnodes back */
(void)PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0,
volptr, &client);
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_FetchStatus;
code = SAFSS_FetchStatus(acall, Fid, OutStatus, CallBack, Sync);
Bad_FetchStatus:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client = NULL; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon;
+ struct host *thost;
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
struct fs_stats_xferData *xferP; /* Ptr to this op's byte size struct */
FS_LOCK;
AFSCallStats.StoreData++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_StoreData;
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(5,
("StoreData: Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume,
- Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr),
+ Fid->Vnode, Fid->Unique, rxr_AddrStringOf(tcon),
ntohs(rxr_PortOf(tcon)), t_client->ViceId));
/*
volptr, &client);
ViceLog(2, ("SAFS_StoreData returns %d\n", errorCode));
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
afs_uint32 Length, afs_uint32 FileLength,
struct AFSFetchStatus * OutStatus, struct AFSVolSync * Sync)
{
+ if (FileLength > 0x7fffffff || Pos > 0x7fffffff ||
+ (0x7fffffff - Pos) < Length)
+ return EFBIG;
+
return common_StoreData64(acall, Fid, InStatus, Pos, Length, FileLength,
OutStatus, Sync);
} /*SRXAFS_StoreData */
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */
FS_UNLOCK;
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_StoreACL;
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_StoreACL, Fid = %u.%u.%u, ACL=%s, Host %s:%d, Id %d\n",
Fid->Volume, Fid->Vnode, Fid->Unique, AccessList->AFSOpaque_val,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.StoreACL++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0,
volptr, &client);
ViceLog(2, ("SAFS_StoreACL returns %d\n", errorCode));
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client = NULL; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_StoreStatus, Fid = %u.%u.%u, Host %s:%d, Id %d\n",
- Fid->Volume, Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr),
+ Fid->Volume, Fid->Vnode, Fid->Unique, rxr_AddrStringOf(tcon),
ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.StoreStatus++, AFSCallStats.TotalCalls++;
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_StoreStatus;
code = SAFSS_StoreStatus(acall, Fid, InStatus, OutStatus, Sync);
Bad_StoreStatus:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
FidZero(&dir);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_RemoveFile %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name,
DirFid->Volume, DirFid->Vnode, DirFid->Unique,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.RemoveFile++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_RemoveFile;
code = SAFSS_RemoveFile(acall, DirFid, Name, OutDirStatus, Sync);
Bad_RemoveFile:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
FidZero(&dir);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_CreateFile %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name,
DirFid->Volume, DirFid->Vnode, DirFid->Unique,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.CreateFile++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
memset(OutFid, 0, sizeof(struct AFSFid));
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_CreateFile;
code =
OutDirStatus, CallBack, Sync);
Bad_CreateFile:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
int doDelete; /* deleted the rename target (ref count now 0) */
int code;
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
FidZero(&olddir);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_Rename %s to %s, Fid = %u.%u.%u to %u.%u.%u, Host %s:%d, Id %d\n",
OldName, NewName, OldDirFid->Volume, OldDirFid->Vnode,
OldDirFid->Unique, NewDirFid->Volume, NewDirFid->Vnode,
- NewDirFid->Unique, inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ NewDirFid->Unique, rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.Rename++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_Rename;
code =
OutOldDirStatus, OutNewDirStatus, Sync);
Bad_Rename:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
FdHandle_t *fdP;
struct rx_connection *tcon = rx_ConnectionOf(acall);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_Symlink %s to %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name,
LinkContents, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.Symlink++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_Symlink;
code =
OutFidStatus, OutDirStatus, Sync);
Bad_Symlink:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
FidZero(&dir);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_Link %s, Did = %u.%u.%u, Fid = %u.%u.%u, Host %s:%d, Id %d\n",
Name, DirFid->Volume, DirFid->Vnode, DirFid->Unique,
ExistingFid->Volume, ExistingFid->Vnode, ExistingFid->Unique,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.Link++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_Link;
code =
OutDirStatus, Sync);
Bad_Link:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
FidZero(&dir);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_MakeDir %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name,
DirFid->Volume, DirFid->Vnode, DirFid->Unique,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.MakeDir++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
FS_UNLOCK;
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_MakeDir;
code =
OutDirStatus, CallBack, Sync);
Bad_MakeDir:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
afs_int32 rights, anyrights; /* rights for this and any user */
Vnode debugvnode1, debugvnode2;
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
FidZero(&dir);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_RemoveDir %s, Did = %u.%u.%u, Host %s:%d, Id %d\n", Name,
DirFid->Volume, DirFid->Vnode, DirFid->Unique,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.RemoveDir++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_RemoveDir;
code = SAFSS_RemoveDir(acall, DirFid, Name, OutDirStatus, Sync);
Bad_RemoveDir:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
- static char *locktype[2] = { "LockRead", "LockWrite" };
+ static char *locktype[4] = { "LockRead", "LockWrite", "LockExtend", "LockRelease" };
struct rx_connection *tcon = rx_ConnectionOf(acall);
if (type != LockRead && type != LockWrite) {
}
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_SetLock type = %s Fid = %u.%u.%u, Host %s:%d, Id %d\n",
locktype[(int)type], Fid->Volume, Fid->Vnode, Fid->Unique,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
+ rxr_AddrStringOf(tcon), ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.SetLock++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
SetVolumeSync(Sync, volptr);
/* Handle the particular type of set locking, type */
- errorCode = HandleLocking(targetptr, rights, type);
+ errorCode = HandleLocking(targetptr, client, rights, type);
Bad_SetLock:
/* Write the all modified vnodes (parent, new files) and volume back */
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_SetLock;
code = SAFSS_SetLock(acall, Fid, type, Sync);
Bad_SetLock:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_ExtendLock Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume,
- Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr),
+ Fid->Vnode, Fid->Unique, rxr_AddrStringOf(tcon),
ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.ExtendLock++, AFSCallStats.TotalCalls++;
SetVolumeSync(Sync, volptr);
/* Handle the actual lock extension */
- errorCode = HandleLocking(targetptr, rights, LockExtend);
+ errorCode = HandleLocking(targetptr, client, rights, LockExtend);
Bad_ExtendLock:
/* Put back file's vnode and volume */
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_ExtendLock;
code = SAFSS_ExtendLock(acall, Fid, Sync);
Bad_ExtendLock:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
struct client *client = 0; /* pointer to client structure */
afs_int32 rights, anyrights; /* rights for this and any user */
struct client *t_client; /* tmp ptr to client data */
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
struct rx_connection *tcon = rx_ConnectionOf(acall);
/* Get ptr to client data for user Id for logging */
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
- logHostAddr.s_addr = rxr_HostOf(tcon);
ViceLog(1,
("SAFS_ReleaseLock Fid = %u.%u.%u, Host %s:%d, Id %d\n", Fid->Volume,
- Fid->Vnode, Fid->Unique, inet_ntoa(logHostAddr),
+ Fid->Vnode, Fid->Unique, rxr_AddrStringOf(tcon),
ntohs(rxr_PortOf(tcon)), t_client->ViceId));
FS_LOCK;
AFSCallStats.ReleaseLock++, AFSCallStats.TotalCalls++;
SetVolumeSync(Sync, volptr);
/* Handle the actual lock release */
- if ((errorCode = HandleLocking(targetptr, rights, LockRelease)))
+ if ((errorCode = HandleLocking(targetptr, client, rights, LockRelease)))
goto Bad_ReleaseLock;
/* if no more locks left, a callback would be triggered here */
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_ReleaseLock;
code = SAFSS_ReleaseLock(acall, Fid, Sync);
Bad_ReleaseLock:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
{
afs_int32 code;
struct rx_connection *tcon = rx_ConnectionOf(acall);
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost)))
goto Bad_GetStatistics;
ViceLog(1, ("SAFS_GetStatistics Received\n"));
SetSystemStats((struct AFSStatistics *)Statistics);
Bad_GetStatistics:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
{ /*SRXAFS_XStatsVersion */
struct client *t_client = NULL; /* tmp ptr to client data */
- struct rx_connection *tcon;
+ struct rx_connection *tcon = rx_ConnectionOf(a_call);
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */
static void
FillPerfValues(struct afs_PerfStats *a_perfP)
{ /*FillPerfValues */
-
+ afs_uint32 hi, lo;
int dir_Buffers; /*# buffers in use by dir package */
int dir_Calls; /*# read calls in dir package */
int dir_IOs; /*# I/O ops in dir package */
a_perfP->vcache_S_Gets = VnodeClassInfo[vSmall].gets;
a_perfP->vcache_S_Reads = VnodeClassInfo[vSmall].reads;
a_perfP->vcache_S_Writes = VnodeClassInfo[vSmall].writes;
- a_perfP->vcache_H_Entries = VolumeCacheSize;
- a_perfP->vcache_H_Gets = VolumeGets;
- a_perfP->vcache_H_Replacements = VolumeReplacements;
+ a_perfP->vcache_H_Entries = VStats.hdr_cache_size;
+ SplitInt64(VStats.hdr_gets, hi, lo);
+ a_perfP->vcache_H_Gets = lo;
+ SplitInt64(VStats.hdr_loads, hi, lo);
+ a_perfP->vcache_H_Replacements = lo;
/*
* Directory section.
#endif
break;
+ case AFS_XSTATSCOLL_CBSTATS:
+ afs_perfstats.numPerfCalls++;
+
+ dataBytes = sizeof(struct cbcounters);
+ dataBuffP = (afs_int32 *) malloc(dataBytes);
+ {
+ extern struct cbcounters cbstuff;
+ dataBuffP[0]=cbstuff.DeleteFiles;
+ dataBuffP[1]=cbstuff.DeleteCallBacks;
+ dataBuffP[2]=cbstuff.BreakCallBacks;
+ dataBuffP[3]=cbstuff.AddCallBacks;
+ dataBuffP[4]=cbstuff.GotSomeSpaces;
+ dataBuffP[5]=cbstuff.DeleteAllCallBacks;
+ dataBuffP[6]=cbstuff.nFEs;
+ dataBuffP[7]=cbstuff.nCBs;
+ dataBuffP[8]=cbstuff.nblks;
+ dataBuffP[9]=cbstuff.CBsTimedOut;
+ dataBuffP[10]=cbstuff.nbreakers;
+ dataBuffP[11]=cbstuff.GSS1;
+ dataBuffP[12]=cbstuff.GSS2;
+ dataBuffP[13]=cbstuff.GSS3;
+ dataBuffP[14]=cbstuff.GSS4;
+ dataBuffP[15]=cbstuff.GSS5;
+ }
+
+ a_dataP->AFS_CollData_len = dataBytes >> 2;
+ a_dataP->AFS_CollData_val = dataBuffP;
+ break;
+
+
default:
/*
* Illegal collection number.
register int i;
struct client *client = 0;
struct rx_connection *tcon;
+ struct host *thost;
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */
FS_LOCK;
AFSCallStats.GiveUpCallBacks++, AFSCallStats.TotalCalls++;
FS_UNLOCK;
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_GiveUpCallBacks;
if (!FidArray && !CallBackArray) {
ViceLog(1,
- ("SAFS_GiveUpAllCallBacks: host=%x\n",
- (tcon->peer ? tcon->peer->host : 0)));
+ ("SAFS_GiveUpAllCallBacks: host=%s\n",
+ (tcon->peer ? rx_AddrStringOf(tcon->peer) : "<unknown>")));
errorCode = GetClient(tcon, &client);
if (!errorCode) {
DeleteAllCallBacks_r(client->host, 1);
} else {
if (FidArray->AFSCBFids_len < CallBackArray->AFSCBs_len) {
ViceLog(0,
- ("GiveUpCallBacks: #Fids %d < #CallBacks %d, host=%x\n",
+ ("GiveUpCallBacks: #Fids %d < #CallBacks %d, host=%s\n",
FidArray->AFSCBFids_len, CallBackArray->AFSCBs_len,
- (tcon->peer ? tcon->peer->host : 0)));
+ (tcon->peer ? rx_AddrStringOf(tcon->peer) : "<unknown>")));
errorCode = EINVAL;
goto Bad_GiveUpCallBacks;
}
}
Bad_GiveUpCallBacks:
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
afs_int32 *dataBuffP;
afs_int32 dataBytes;
-#if FS_STATS_DETAILED
- struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
- struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */
- struct timeval elapsedTime; /* Transfer time */
- /*
- * Set our stats pointer, remember when the RPC operation started, and
- * tally the operation.
- */
- opP = &(afs_FullPerfStats.det.rpcOpTimes[FS_STATS_RPCIDX_GETCAPABILITIES]);
FS_LOCK;
- (opP->numOps)++;
+ AFSCallStats.GetCapabilities++, AFSCallStats.TotalCalls++;
+ afs_FullPerfStats.overall.fs_nGetCaps++;
FS_UNLOCK;
- TM_GetTimeOfDay(&opStartTime, 0);
-#endif /* FS_STATS_DETAILED */
+ ViceLog(2, ("SAFS_GetCapabilties\n"));
- if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost)))
goto Bad_GetCaps;
- FS_LOCK;
- AFSCallStats.GetCapabilities++, AFSCallStats.TotalCalls++;
- FS_UNLOCK;
dataBytes = 1 * sizeof(afs_int32);
dataBuffP = (afs_int32 *) malloc(dataBytes);
dataBuffP[0] = VICED_CAPABILITY_ERRORTRANS;
capabilities->Capabilities_len = dataBytes / sizeof(afs_int32);
capabilities->Capabilities_val = dataBuffP;
- ViceLog(2, ("SAFS_GetCapabilties\n"));
-
Bad_GetCaps:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
+
-#if FS_STATS_DETAILED
- TM_GetTimeOfDay(&opStopTime, 0);
- fs_stats_GetDiff(elapsedTime, opStartTime, opStopTime);
- if (code == 0) {
- FS_LOCK;
- (opP->numSuccesses)++;
- fs_stats_AddTo((opP->sumTime), elapsedTime);
- fs_stats_SquareAddTo((opP->sqrTime), elapsedTime);
- if (fs_stats_TimeLessThan(elapsedTime, (opP->minTime))) {
- fs_stats_TimeAssign((opP->minTime), elapsedTime);
- }
- if (fs_stats_TimeGreaterThan(elapsedTime, (opP->maxTime))) {
- fs_stats_TimeAssign((opP->maxTime), elapsedTime);
- }
- FS_UNLOCK;
- }
-#endif /* FS_STATS_DETAILED */
return 0;
}
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */
FS_UNLOCK;
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_GetVolumeInfo;
FS_LOCK;
avolinfo->Type4 = 0xabcd9999; /* tell us to try new vldb */
Bad_GetVolumeInfo:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
afs_int32 rights, anyrights; /* rights for this and any user */
AFSFid dummyFid;
struct rx_connection *tcon;
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
#endif /* FS_STATS_DETAILED */
ViceLog(1, ("SAFS_GetVolumeStatus for volume %u\n", avolid));
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_GetVolumeStatus;
FS_LOCK;
*OfflineMsg = (char *)malloc(1);
**OfflineMsg = 0;
}
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
afs_int32 rights, anyrights; /* rights for this and any user */
AFSFid dummyFid;
struct rx_connection *tcon = rx_ConnectionOf(acall);
+ struct host *thost;
struct client *t_client = NULL; /* tmp ptr to client data */
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
#endif /* FS_STATS_DETAILED */
ViceLog(1, ("SAFS_SetVolumeStatus for volume %u\n", avolid));
- if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_SetVolumeStatus;
FS_LOCK;
PutVolumePackage(parentwhentargetnotdir, targetptr, (Vnode *) 0,
volptr, &client);
ViceLog(2, ("SAFS_SetVolumeStatus returns %d\n", errorCode));
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
t_client = (struct client *)rx_GetSpecific(tcon, rxcon_client_key);
int len;
char *temp;
struct rx_connection *tcon;
+ struct host *thost;
#endif
int errorCode = 0;
#if FS_STATS_DETAILED
return FSERR_EOPNOTSUPP;
#ifdef notdef
- if (errorCode = CallPreamble(acall, ACTIVECALL, &tcon))
+ if (errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &thost))
goto Bad_GetRootVolume;
FS_LOCK;
AFSCallStats.GetRootVolume++, AFSCallStats.TotalCalls++;
*VolumeName = temp; /* freed by rx server-side stub */
Bad_GetRootVolume:
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
struct timeval opStartTime, opStopTime; /* Start/stop times for RPC op */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, ACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, ACTIVECALL, &tcon, &thost)))
goto Bad_CheckToken;
code = FSERR_ECONNREFUSED;
Bad_CheckToken:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
{
afs_int32 code;
struct rx_connection *tcon;
+ struct host *thost;
struct timeval tpl;
#if FS_STATS_DETAILED
struct fs_stats_opTimingData *opP; /* Ptr to this op's timing struct */
TM_GetTimeOfDay(&opStartTime, 0);
#endif /* FS_STATS_DETAILED */
- if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon)))
+ if ((code = CallPreamble(acall, NOTACTIVECALL, &tcon, &thost)))
goto Bad_GetTime;
FS_LOCK;
ViceLog(2, ("SAFS_GetTime returns %u, %u\n", *Seconds, *USeconds));
Bad_GetTime:
- code = CallPostamble(tcon, code);
+ code = CallPostamble(tcon, code, thost);
#if FS_STATS_DETAILED
TM_GetTimeOfDay(&opStopTime, 0);
errorCode = rx_WritevAlloc(Call, tiov, &tnio, RX_MAXIOVECS, wlen);
if (errorCode <= 0) {
FDH_CLOSE(fdP);
- VTakeOffline(volptr);
return EIO;
}
wlen = errorCode;
afs_sfsize_t adjustSize; /* bytes to call VAdjust... with */
int linkCount; /* link count on inode */
FdHandle_t *fdP;
- struct in_addr logHostAddr; /* host ip holder for inet_ntoa */
#if FS_STATS_DETAILED
/*
if (Pos == -1 || VN_GET_INO(targetptr) == 0) {
/* the inode should have been created in Alloc_NewVnode */
- logHostAddr.s_addr = rxr_HostOf(rx_ConnectionOf(Call));
ViceLog(0,
("StoreData_RXStyle : Inode non-existent Fid = %u.%u.%u, inode = %llu, Pos %llu Host %s:%d\n",
Fid->Volume, Fid->Vnode, Fid->Unique,
(afs_uintmax_t) VN_GET_INO(targetptr), (afs_uintmax_t) Pos,
- inet_ntoa(logHostAddr), ntohs(rxr_PortOf(rx_ConnectionOf(Call)))));
+ rxr_AddrStringOf(rx_ConnectionOf(Call)),
+ ntohs(rxr_PortOf(rx_ConnectionOf(Call)))));
return ENOENT; /* is this proper error code? */
} else {
/*
sys2et[EMEDIUMTYPE] = UAEMEDIUMTYPE;
}
+/* NOTE: 2006-03-01
+ * SRXAFS_CallBackRxConnAddr should be re-written as follows:
+ * - pass back the connection, client, and host from CallPreamble
+ * - keep a ref on the client, which we don't now
+ * - keep a hold on the host, which we already do
+ * - pass the connection, client, and host down into SAFSS_*, and use
+ * them instead of independently discovering them via rx_ConnectionOf
+ * (safe) and rx_GetSpecific (not so safe)
+ * The idea being that we decide what client and host we're going to use
+ * when CallPreamble is called, and stay consistent throughout the call.
+ * This change is too invasive for 1.4.1 but should be made in 1.5.x.
+ */
+
afs_int32
SRXAFS_CallBackRxConnAddr (struct rx_call * acall, afs_int32 *addr)
{
Error errorCode = 0;
struct rx_connection *tcon;
+ struct host *tcallhost;
#ifdef __EXPERIMENTAL_CALLBACK_CONN_MOVING
struct host *thost;
struct client *tclient;
struct rx_connection *conn;
#endif
- if (errorCode = CallPreamble(acall, ACTIVECALL, &tcon))
+ if (errorCode = CallPreamble(acall, ACTIVECALL, &tcon, &tcallhost))
goto Bad_CallBackRxConnAddr1;
#ifndef __EXPERIMENTAL_CALLBACK_CONN_MOVING
thost->host = addr;
rx_SetConnDeadTime(thost->callback_rxcon, 50);
rx_SetConnHardDeadTime(thost->callback_rxcon, AFS_HARDDEADTIME);
+ h_ReleaseClient_r(tclient);
+ /* The hold on thost will be released by CallPostamble */
H_UNLOCK;
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, tcallhost);
return errorCode;
} else {
rx_DestroyConnection(conn);
}
Bad_CallBackRxConnAddr:
+ h_ReleaseClient_r(tclient);
+ /* The hold on thost will be released by CallPostamble */
H_UNLOCK;
#endif
- errorCode = CallPostamble(tcon, errorCode);
+ errorCode = CallPostamble(tcon, errorCode, tcallhost);
Bad_CallBackRxConnAddr1:
return errorCode; /* failure */
}