static int
VLDB_Same(struct VenusFid *afid, struct vrequest *areq)
{
- struct vrequest treq;
+ struct vrequest *treq = NULL;
struct afs_conn *tconn;
int i, type = 0;
union {
AFS_STATCNT(CheckVLDB);
afs_FinalizeReq(areq);
- if ((i = afs_InitReq(&treq, afs_osi_credp)))
+ if ((i = afs_CreateReq(&treq, afs_osi_credp)))
return DUNNO;
v = afs_osi_Alloc(sizeof(*v));
osi_Assert(v != NULL);
VSleep(2); /* Better safe than sorry. */
tconn =
afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cellNum,
- &treq, SHARED_LOCK, 0, &rxconn);
+ treq, SHARED_LOCK, 0, &rxconn);
if (tconn) {
if ( tconn->parent->srvr->server->flags & SNO_LHOSTS) {
type = 0;
}
} else
i = -1;
- } while (afs_Analyze(tconn, rxconn, i, NULL, &treq, -1, /* no op code for this */
+ } while (afs_Analyze(tconn, rxconn, i, NULL, treq, -1, /* no op code for this */
SHARED_LOCK, tcell));
afs_PutCell(tcell, READ_LOCK);
ICL_TYPE_INT32, i);
if (i) {
+ afs_DestroyReq(treq);
afs_osi_Free(v, sizeof(*v));
return DUNNO;
}
ReleaseWriteLock(&tvp->lock);
if (type == 2) {
- LockAndInstallUVolumeEntry(tvp, &v->utve, afid->Cell, tcell, &treq);
+ LockAndInstallUVolumeEntry(tvp, &v->utve, afid->Cell, tcell, treq);
} else if (type == 1) {
LockAndInstallNVolumeEntry(tvp, &v->ntve, afid->Cell);
} else {
ReleaseWriteLock(&tvp->lock);
afs_PutVolume(tvp, WRITE_LOCK);
} else { /* can't find volume */
- tvp = afs_GetVolume(afid, &treq, WRITE_LOCK);
+ tvp = afs_GetVolume(afid, treq, WRITE_LOCK);
if (tvp) {
afs_PutVolume(tvp, WRITE_LOCK);
+ afs_DestroyReq(treq);
afs_osi_Free(v, sizeof(*v));
return DIFFERENT;
} else {
+ afs_DestroyReq(treq);
afs_osi_Free(v, sizeof(*v));
return DUNNO;
}
}
+ afs_DestroyReq(treq);
afs_osi_Free(v, sizeof(*v));
return (changed ? DIFFERENT : SAME);
} /*VLDB_Same */
{
afs_int32 code;
- struct vrequest treq;
int setDesire = 0;
int setManual = 0;
/* cg2v, try to store any chunks not written 20071204 */
if (avc->execsOrWriters > 0) {
- code = afs_InitReq(&treq, acred);
- if (!code)
- code = afs_StoreAllSegments(avc, &treq, AFS_SYNC | AFS_LASTSTORE);
+ struct vrequest *treq = NULL;
+
+ code = afs_CreateReq(&treq, acred);
+ if (!code) {
+ code = afs_StoreAllSegments(avc, treq, AFS_SYNC | AFS_LASTSTORE);
+ afs_DestroyReq(treq);
+ }
}
#if 0
afs_int32 code;
afs_int32 bcnt;
struct brequest *breq;
- struct vrequest *areq;
-
- /* the reciever will free this */
- areq = osi_Alloc(sizeof(struct vrequest));
+ struct vrequest *areq = NULL;
if (avc->vc_error) {
code = EIO;
afs_warn("afs_ReadNoCache VCache Error!\n");
goto cleanup;
}
- if ((code = afs_InitReq(areq, acred))) {
- afs_warn("afs_ReadNoCache afs_InitReq error!\n");
- goto cleanup;
- }
AFS_GLOCK();
- code = afs_VerifyVCache(avc, areq);
+ /* the receiver will free areq */
+ code = afs_CreateReq(&areq, acred);
+ if (code) {
+ afs_warn("afs_ReadNoCache afs_CreateReq error!\n");
+ } else {
+ code = afs_VerifyVCache(avc, areq);
+ if (code) {
+ afs_warn("afs_ReadNoCache Failed to verify VCache!\n");
+ }
+ }
AFS_GUNLOCK();
if (code) {
code = afs_CheckCode(code, areq, 11); /* failed to get it */
- afs_warn("afs_ReadNoCache Failed to verify VCache!\n");
goto cleanup;
}
* processed, like unlocking the pages and freeing memory.
*/
unlock_and_release_pages(bparms->auio);
- osi_Free(areq, sizeof(struct vrequest));
+ AFS_GLOCK();
+ afs_DestroyReq(areq);
+ AFS_GUNLOCK();
osi_Free(bparms->auio->uio_iov,
bparms->auio->uio_iovcnt * sizeof(struct iovec));
osi_Free(bparms->auio, sizeof(struct uio));
*/
#ifdef AFS_LINUX20_ENV
{
- struct vrequest treq;
+ struct vrequest *treq = NULL;
struct vattr vattr;
cred_t *credp;
struct dentry *dp;
afs_rootFid.Fid.Unique = 1;
credp = crref();
- if (afs_InitReq(&treq, credp))
+ if (afs_CreateReq(&treq, credp))
goto out;
- vcp = afs_GetVCache(&afs_rootFid, &treq, NULL, NULL);
+ vcp = afs_GetVCache(&afs_rootFid, treq, NULL, NULL);
if (!vcp)
goto out;
afs_getattr(vcp, &vattr, credp);
afs_globalVp = vcp;
out:
crfree(credp);
+ afs_DestroyReq(treq);
}
#else
#ifdef AFS_DARWIN80_ENV
struct dentry *dp = NULL;
#endif
afs_size_t offset, len;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
afs_int32 code;
AFS_STATCNT(BPath);
- if ((code = afs_InitReq(&treq, ab->cred)))
+ if ((code = afs_CreateReq(&treq, ab->cred))) {
return;
+ }
AFS_GUNLOCK();
#ifdef AFS_LINUX22_ENV
code = gop_lookupname((char *)ab->ptr_parm[0], AFS_UIOSYS, 1, &dp);
#endif
AFS_GLOCK();
osi_FreeLargeSpace((char *)ab->ptr_parm[0]); /* free path name buffer here */
- if (code)
+ if (code) {
+ afs_DestroyReq(treq);
return;
+ }
/* now path may not have been in afs, so check that before calling our cache manager */
if (!tvn || !IsAfsVnode(tvn)) {
/* release it and give up */
AFS_RELE(tvn);
#endif
}
+ afs_DestroyReq(treq);
return;
}
tvc = VTOAFS(tvn);
/* here we know its an afs vnode, so we can get the data for the chunk */
- tdc = afs_GetDCache(tvc, ab->size_parm[0], &treq, &offset, &len, 1);
+ tdc = afs_GetDCache(tvc, ab->size_parm[0], treq, &offset, &len, 1);
if (tdc) {
afs_PutDCache(tdc);
}
#else
AFS_RELE(tvn);
#endif
+ afs_DestroyReq(treq);
}
/* size_parm 0 to the fetch is the chunk number,
struct dcache *tdc;
struct vcache *tvc;
afs_size_t offset, len, abyte, totallen = 0;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
+ int code;
AFS_STATCNT(BPrefetch);
- if ((len = afs_InitReq(&treq, ab->cred)))
+ if ((code = afs_CreateReq(&treq, ab->cred)))
return;
abyte = ab->size_parm[0];
tvc = ab->vc;
do {
- tdc = afs_GetDCache(tvc, abyte, &treq, &offset, &len, 1);
+ tdc = afs_GetDCache(tvc, abyte, treq, &offset, &len, 1);
if (tdc) {
afs_PutDCache(tdc);
}
if (ab->size_parm[1]) {
afs_PutDCache(tdc); /* put this one back, too */
}
+ afs_DestroyReq(treq);
}
#if defined(AFS_CACHE_BYPASS)
static void
BPrefetchNoCache(struct brequest *ab)
{
- struct vrequest treq;
- afs_size_t len;
+ struct vrequest *treq = NULL;
+ int code;
- if ((len = afs_InitReq(&treq, ab->cred)))
+ if ((code = afs_CreateReq(&treq, ab->cred)))
return;
#ifndef UKERNEL
/* OS-specific prefetch routine */
afs_PrefetchNoCache(ab->vc, ab->cred, (struct nocache_read_request *) ab->ptr_parm[0]);
#endif
+ afs_DestroyReq(treq);
}
#endif
{
struct vcache *tvc;
afs_int32 code;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
#if defined(AFS_SGI_ENV)
struct cred *tmpcred;
#endif
AFS_STATCNT(BStore);
- if ((code = afs_InitReq(&treq, ab->cred)))
+ if ((code = afs_CreateReq(&treq, ab->cred)))
return;
tvc = ab->vc;
#if defined(AFS_SGI_ENV)
AFS_RWLOCK((vnode_t *) tvc, 1);
#endif
ObtainWriteLock(&tvc->lock, 209);
- code = afs_StoreOnLastReference(tvc, &treq);
+ code = afs_StoreOnLastReference(tvc, treq);
ReleaseWriteLock(&tvc->lock);
#if defined(AFS_SGI_ENV)
OSI_SET_CURRENT_CRED(tmpcred);
* can know the "raw" value for interpreting the value internally, as
* well as the afs_CheckCode value to give to the OS. */
ab->code_raw = code;
- ab->code_checkcode = afs_CheckCode(code, &treq, 430);
+ ab->code_checkcode = afs_CheckCode(code, treq, 430);
ab->flags |= BUVALID;
if (ab->flags & BUWAIT) {
afs_osi_Wakeup(ab);
}
}
+ afs_DestroyReq(treq);
}
static void
{
struct vcache *tvc;
afs_int32 code;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
int locked, shared_locked = 0;
AFS_STATCNT(BStore);
- if ((code = afs_InitReq(&treq, ab->cred)))
+ if ((code = afs_CreateReq(&treq, ab->cred)))
return;
tvc = ab->vc;
locked = tvc->lock.excl_locked? 1:0;
shared_locked = 1;
ConvertSToRLock(&tvc->lock);
}
- code = afs_StoreAllSegments(tvc, &treq, AFS_ASYNC);
+ code = afs_StoreAllSegments(tvc, treq, AFS_ASYNC);
if (!locked)
ReleaseWriteLock(&tvc->lock);
else if (shared_locked)
if ((ab->flags & BUVALID) == 0) {
/* set final code, since treq doesn't go across processes */
ab->code_raw = code;
- ab->code_checkcode = afs_CheckCode(code, &treq, 43);
+ ab->code_checkcode = afs_CheckCode(code, treq, 43);
ab->flags |= BUVALID;
if (ab->flags & BUWAIT) {
ab->flags &= ~BUWAIT;
afs_osi_Wakeup(ab);
}
}
+ afs_DestroyReq(treq);
}
/* release a held request buffer */
struct VenusFid vfid;
struct SmallFid Sfid;
struct cell *tcell;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
afs_int32 code = 0, cellindex;
afs_int32 ret;
code = ENOENT;
} else if (ret == 0) {
/* didn't find an entry. */
- *avcpp = afs_GetVCache(&vfid, &treq, NULL, NULL);
+ code = afs_CreateReq(&treq, NULL);
+ if (code == 0) {
+ *avcpp = afs_GetVCache(&vfid, treq, NULL, NULL);
+ afs_DestroyReq(treq);
+ }
}
if (!*avcpp) {
code = ENOENT;
afs_ucred_t **acred)
{
struct vcache *avc;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
afs_int32 code;
afs_int32 function, device;
struct afs_pdata input, output;
ICL_TYPE_POINTER, avc, ICL_TYPE_INT32, afollow);
AFS_STATCNT(HandlePioctl);
- code = afs_InitReq(&treq, *acred);
+ code = afs_CreateReq(&treq, *acred);
if (code)
return code;
afs_InitFakeStat(&fakestate);
if (avc) {
- code = afs_EvalFakeStat(&avc, &fakestate, &treq);
+ code = afs_EvalFakeStat(&avc, &fakestate, treq);
if (code)
goto out;
}
copyOutput = output;
code =
- (*pioctlSw[function]) (avc, function, &treq, ©Input,
+ (*pioctlSw[function]) (avc, function, treq, ©Input,
©Output, acred);
outSize = copyOutput.ptr - output.ptr;
afs_pd_free(&output);
afs_PutFakeStat(&fakestate);
- return afs_CheckCode(code, &treq, 41);
+ code = afs_CheckCode(code, treq, 41);
+ afs_DestroyReq(treq);
+ return code;
}
/*!
char *stp;
char *cellName;
int stLen;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
afs_int32 flag, set_parent_pag = 0;
AFS_STATCNT(PSetTokens);
if (set_parent_pag) {
if (_settok_setParentPag(acred) == 0) {
- code = afs_InitReq(&treq, *acred);
+ code = afs_CreateReq(&treq, *acred);
if (code) {
return code;
}
- areq = &treq;
+ areq = treq;
}
}
afs_ResetUserConns(tu);
afs_NotifyUser(tu, UTokensObtained);
afs_PutUser(tu, WRITE_LOCK);
+ afs_DestroyReq(treq);
return 0;
}
int i, cellNum, primaryFlag;
XDR xdrs;
struct unixuser *tu;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
struct ktc_setTokenData tokenSet;
struct ktc_tokenUnion decodedToken;
*acred = crref();
crfree(old_cred);
#endif
- code = afs_InitReq(&treq, *acred);
+ code = afs_CreateReq(&treq, *acred);
if (code) {
xdr_free((xdrproc_t) xdr_ktc_setTokenData, &tokenSet);
return code;
}
- areq = &treq;
+ areq = treq;
}
}
out:
afs_ResetUserConns(tu);
afs_PutUser(tu, WRITE_LOCK);
+ afs_DestroyReq(treq);
return code;
}
void (*func2) (int nservers, struct rx_connection **rxconns,
struct afs_conn **conns))
{
- struct vrequest treq;
+ struct vrequest *treq = NULL;
struct server *ts;
struct srvAddr *sa;
struct afs_conn *tc = NULL;
if (AFS_IS_DISCONNECTED)
return;
- if ((code = afs_InitReq(&treq, afs_osi_credp)))
+ if ((code = afs_CreateReq(&treq, afs_osi_credp)))
return;
ObtainReadLock(&afs_xserver); /* Necessary? */
ObtainReadLock(&afs_xsrvAddr);
/* check vlserver with special code */
if (sa->sa_portal == AFS_VLPORT) {
if (vlalso)
- CheckVLServer(sa, &treq);
+ CheckVLServer(sa, treq);
continue;
}
continue; /* have just been added by setsprefs */
/* get a connection, even if host is down; bumps conn ref count */
- tu = afs_GetUser(treq.uid, ts->cell->cellNum, SHARED_LOCK);
+ tu = afs_GetUser(treq->uid, ts->cell->cellNum, SHARED_LOCK);
tc = afs_ConnBySA(sa, ts->cell->fsport, ts->cell->cellNum, tu,
1 /*force */ , 1 /*create */ , SHARED_LOCK, 0,
&rxconn);
afs_osi_Free(conns, j * sizeof(struct afs_conn *));
afs_osi_Free(rxconns, j * sizeof(struct rx_connection *));
afs_osi_Free(conntimer, j * sizeof(afs_int32));
+ afs_DestroyReq(treq);
} /*afs_CheckServers*/
afs_GetCapabilities(struct server *ts)
{
Capabilities caps = {0, NULL};
- struct vrequest treq;
+ struct vrequest *treq = NULL;
struct afs_conn *tc;
struct unixuser *tu;
struct rx_connection *rxconn;
if ( !afs_osi_credp )
return;
- if ((code = afs_InitReq(&treq, afs_osi_credp)))
+ if ((code = afs_CreateReq(&treq, afs_osi_credp)))
return;
- tu = afs_GetUser(treq.uid, ts->cell->cellNum, SHARED_LOCK);
- if ( !tu )
+ tu = afs_GetUser(treq->uid, ts->cell->cellNum, SHARED_LOCK);
+ if ( !tu ) {
+ afs_DestroyReq(treq);
return;
+ }
tc = afs_ConnBySA(ts->addr, ts->cell->fsport, ts->cell->cellNum, tu, 0, 1,
SHARED_LOCK, 0, &rxconn);
afs_PutUser(tu, SHARED_LOCK);
- if ( !tc )
+ if ( !tc ) {
+ afs_DestroyReq(treq);
return;
+ }
/* InitCallBackStateN, triggered by our RPC, may need this */
ReleaseWriteLock(&afs_xserver);
code = RXAFS_GetCapabilities(rxconn, &caps);
if ( code && code != RXGEN_OPCODE ) {
afs_warn("RXAFS_GetCapabilities failed with code %d\n", code);
/* better not be anything to free. we failed! */
+ afs_DestroyReq(treq);
return;
}
caps.Capabilities_val = NULL;
}
+ afs_DestroyReq(treq);
}
static struct server *
int tcount;
struct server *tsp;
int i;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
struct afs_conn *tc;
int safety1, safety2, safety3;
XSTATS_DECLS;
if (AFS_IS_DISCONNECTED)
return ENETDOWN;
- if ((code = afs_InitReq(&treq, afs_osi_credp)))
+ if ((code = afs_CreateReq(&treq, afs_osi_credp)))
return code;
- treq.flags |= O_NONBLOCK;
+ treq->flags |= O_NONBLOCK;
tfids = afs_osi_Alloc(sizeof(struct AFSFid) * AFS_MAXCBRSCALL);
osi_Assert(tfids != NULL);
callBacks[0].CallBackType = CB_EXCLUSIVE;
for (safety3 = 0; safety3 < AFS_MAXHOSTS * 2; safety3++) {
tc = afs_ConnByHost(tsp, tsp->cell->fsport,
- tsp->cell->cellNum, &treq, 0,
+ tsp->cell->cellNum, treq, 0,
SHARED_LOCK, 0, &rxconn);
if (tc) {
XSTATS_START_TIME
} else
code = -1;
if (!afs_Analyze
- (tc, rxconn, code, 0, &treq,
+ (tc, rxconn, code, 0, treq,
AFS_STATS_FS_RPCIDX_GIVEUPCALLBACKS, SHARED_LOCK,
tsp->cell)) {
break;
if (lockit)
ReleaseWriteLock(&afs_xvcb);
afs_osi_Free(tfids, sizeof(struct AFSFid) * AFS_MAXCBRSCALL);
+ afs_DestroyReq(treq);
return 0;
}
struct afs_conn *tc;
afs_int32 code;
afs_ucred_t *cred = NULL;
- struct vrequest treq, ureq;
+ struct vrequest *treq = NULL;
struct AFSVolSync tsync;
int didCore;
XSTATS_DECLS;
AFS_STATCNT(afs_FlushActiveVcaches);
+
+ code = afs_CreateReq(&treq, NULL);
+ if (code) {
+ afs_warn("unable to alloc treq\n");
+ return;
+ }
+
ObtainReadLock(&afs_xvcache);
for (i = 0; i < VCSIZE; i++) {
for (tvc = afs_vhashT[i]; tvc; tvc = tvc->hnext) {
ReleaseReadLock(&afs_xvcache);
ObtainWriteLock(&tvc->lock, 51);
do {
- code = afs_InitReq(&treq, afs_osi_credp);
+ code = afs_InitReq(treq, afs_osi_credp);
if (code) {
code = -1;
break; /* shutting down: do not try to extend the lock */
}
- treq.flags |= O_NONBLOCK;
+ treq->flags |= O_NONBLOCK;
- tc = afs_Conn(&tvc->f.fid, &treq, SHARED_LOCK, &rxconn);
+ tc = afs_Conn(&tvc->f.fid, treq, SHARED_LOCK, &rxconn);
if (tc) {
XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_EXTENDLOCK);
RX_AFS_GUNLOCK();
} else
code = -1;
} while (afs_Analyze
- (tc, rxconn, code, &tvc->f.fid, &treq,
+ (tc, rxconn, code, &tvc->f.fid, treq,
AFS_STATS_FS_RPCIDX_EXTENDLOCK, SHARED_LOCK, NULL));
ReleaseWriteLock(&tvc->lock);
/* XXXX Find better place-holder for cred XXXX */
cred = (afs_ucred_t *)tvc->linkData;
tvc->linkData = NULL; /* XXX */
- code = afs_InitReq(&ureq, cred);
+ code = afs_InitReq(treq, cred);
afs_Trace2(afs_iclSetp, CM_TRACE_ACTCCORE,
ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32,
tvc->execsOrWriters);
if (!code) { /* avoid store when shutting down */
- code = afs_StoreOnLastReference(tvc, &ureq);
+ code = afs_StoreOnLastReference(tvc, treq);
}
ReleaseWriteLock(&tvc->lock);
#ifdef AFS_BOZONLOCK_ENV
}
}
ReleaseReadLock(&afs_xvcache);
+ afs_DestroyReq(treq);
}
struct cell *tcell;
char *tbuffer, *ve;
struct afs_conn *tconn;
- struct vrequest treq;
+ struct vrequest *treq = NULL;
struct rx_connection *rxconn;
if (strlen(aname) > VL_MAXNAMELEN) /* Invalid volume name */
return NULL;
}
- code = afs_InitReq(&treq, afs_osi_credp); /* *must* be unauth for vldb */
+ code = afs_CreateReq(&treq, afs_osi_credp); /* *must* be unauth for vldb */
if (code) {
return NULL;
}
/* allow null request if we don't care about ENODEV/ETIMEDOUT distinction */
if (!areq)
- areq = &treq;
+ areq = treq;
afs_Trace2(afs_iclSetp, CM_TRACE_GETVOL, ICL_TYPE_STRING, aname,
tve = (struct vldbentry *)(tbuffer + 1024);
ntve = (struct nvldbentry *)tve;
utve = (struct uvldbentry *)tve;
+
do {
tconn =
afs_ConnByMHosts(tcell->cellHosts, tcell->vlport, tcell->cellNum,
- &treq, SHARED_LOCK, 0, &rxconn);
+ treq, SHARED_LOCK, 0, &rxconn);
if (tconn) {
if (tconn->parent->srvr->server->flags & SNO_LHOSTS) {
type = 0;
}
} else
code = -1;
- } while (afs_Analyze(tconn, rxconn, code, NULL, &treq, -1, /* no op code for this */
+ } while (afs_Analyze(tconn, rxconn, code, NULL, treq, -1, /* no op code for this */
SHARED_LOCK, tcell));
if (code) {
}
}
#endif
- afs_CopyError(&treq, areq);
+ afs_CopyError(treq, areq);
osi_FreeLargeSpace(tbuffer);
afs_PutCell(tcell, READ_LOCK);
+ afs_DestroyReq(treq);
return NULL;
}
/*
ve = (char *)ntve;
else
ve = (char *)tve;
- tv = afs_SetupVolume(0, aname, ve, tcell, agood, type, &treq);
+ tv = afs_SetupVolume(0, aname, ve, tcell, agood, type, treq);
if ((agood == 3) && tv && tv->backVol) {
/*
* This means that very soon we'll ask for the BK volume so
* we'll prefetch it (well we did already.)
*/
tv1 =
- afs_SetupVolume(tv->backVol, (char *)0, ve, tcell, 0, type, &treq);
+ afs_SetupVolume(tv->backVol, (char *)0, ve, tcell, 0, type, treq);
if (tv1) {
tv1->refCount--;
}
* This means that very soon we'll ask for the RO volume so
* we'll prefetch it (well we did already.)
*/
- tv1 = afs_SetupVolume(tv->roVol, NULL, ve, tcell, 0, type, &treq);
+ tv1 = afs_SetupVolume(tv->roVol, NULL, ve, tcell, 0, type, treq);
if (tv1) {
tv1->refCount--;
}
}
osi_FreeLargeSpace(tbuffer);
afs_PutCell(tcell, READ_LOCK);
+ afs_DestroyReq(treq);
return tv;
} /*afs_NewVolumeByName */