]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
libafs: reduce stack space in VNOPS
authorMichael Meffie <mmeffie@sinenomine.net>
Tue, 8 Apr 2014 20:10:36 +0000 (16:10 -0400)
committerStephan Wiesand <stephan.wiesand@desy.de>
Wed, 13 Aug 2014 15:23:17 +0000 (11:23 -0400)
Allocate temporary vrequests to reduce the amount
of stack space used.

Reviewed-on: http://gerrit.openafs.org/11004
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Reviewed-by: D Brashear <shadow@your-file-system.com>
(cherry picked from commit 9930567bcf9655d3f562b210b2dc4b4a99226691)

Change-Id: I1c60701d4e4f85aedfea6be58a03468ab34edb96
Reviewed-on: http://gerrit.openafs.org/11166
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
14 files changed:
src/afs/VNOPS/afs_vnop_access.c
src/afs/VNOPS/afs_vnop_attrs.c
src/afs/VNOPS/afs_vnop_create.c
src/afs/VNOPS/afs_vnop_dirops.c
src/afs/VNOPS/afs_vnop_flock.c
src/afs/VNOPS/afs_vnop_link.c
src/afs/VNOPS/afs_vnop_lookup.c
src/afs/VNOPS/afs_vnop_open.c
src/afs/VNOPS/afs_vnop_read.c
src/afs/VNOPS/afs_vnop_readdir.c
src/afs/VNOPS/afs_vnop_remove.c
src/afs/VNOPS/afs_vnop_rename.c
src/afs/VNOPS/afs_vnop_symlink.c
src/afs/VNOPS/afs_vnop_write.c

index feb0ca7a4f5b707a34b833a9c66fe94bc4c0d638..00870738be127100374bf5c5cfe01891cecdd890 100644 (file)
@@ -199,7 +199,7 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode,
 #endif
 {
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     struct afs_fakestat_state fakestate;
     OSI_VC_CONVERT(avc);
 
@@ -207,35 +207,40 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode,
     afs_Trace3(afs_iclSetp, CM_TRACE_ACCESS, ICL_TYPE_POINTER, avc,
               ICL_TYPE_INT32, amode, ICL_TYPE_OFFSET,
               ICL_HANDLE_OFFSET(avc->f.m.Length));
+
     afs_InitFakeStat(&fakestate);
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred))) {
        return code;
+    }
 
     AFS_DISCON_LOCK();
 
     if (afs_fakestat_enable && avc->mvstat == 1) {
-       code = afs_TryEvalFakeStat(&avc, &fakestate, &treq);
+       code = afs_TryEvalFakeStat(&avc, &fakestate, treq);
         if (code == 0 && avc->mvstat == 1) {
            afs_PutFakeStat(&fakestate);
            AFS_DISCON_UNLOCK();
+           afs_DestroyReq(treq);
            return 0;
         }
     } else {
-       code = afs_EvalFakeStat(&avc, &fakestate, &treq);
+       code = afs_EvalFakeStat(&avc, &fakestate, treq);
     }
 
     if (code) {
        afs_PutFakeStat(&fakestate);
        AFS_DISCON_UNLOCK();
+       afs_DestroyReq(treq);
        return code;
     }
 
     if (vType(avc) != VDIR || !afs_InReadDir(avc)) {
-       code = afs_VerifyVCache(avc, &treq);
+       code = afs_VerifyVCache(avc, treq);
        if (code) {
            afs_PutFakeStat(&fakestate);
            AFS_DISCON_UNLOCK();
-           code = afs_CheckCode(code, &treq, 16);
+           code = afs_CheckCode(code, treq, 16);
+           afs_DestroyReq(treq);
            return code;
        }
     }
@@ -244,6 +249,7 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode,
     if ((amode & VWRITE) && (avc->f.states & CRO)) {
        afs_PutFakeStat(&fakestate);
        AFS_DISCON_UNLOCK();
+       afs_DestroyReq(treq);
        return EROFS;
     }
     
@@ -252,6 +258,7 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode,
         afs_PutFakeStat(&fakestate);
        AFS_DISCON_UNLOCK();
        /* printf("Network is down in afs_vnop_access\n"); */
+       afs_DestroyReq(treq);
         return ENETDOWN;
     }
     
@@ -259,41 +266,41 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode,
     if (avc->f.states & CForeign) {
        /* In the dfs xlator the EXEC bit is mapped to LOOKUP */
        if (amode & VEXEC)
-           code = afs_AccessOK(avc, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS);
+           code = afs_AccessOK(avc, PRSFS_LOOKUP, treq, CHECK_MODE_BITS);
        if (code && (amode & VWRITE)) {
-           code = afs_AccessOK(avc, PRSFS_WRITE, &treq, CHECK_MODE_BITS);
+           code = afs_AccessOK(avc, PRSFS_WRITE, treq, CHECK_MODE_BITS);
            if (code && (vType(avc) == VDIR)) {
                if (code)
                    code =
-                       afs_AccessOK(avc, PRSFS_INSERT, &treq,
+                       afs_AccessOK(avc, PRSFS_INSERT, treq,
                                     CHECK_MODE_BITS);
                if (!code)
                    code =
-                       afs_AccessOK(avc, PRSFS_DELETE, &treq,
+                       afs_AccessOK(avc, PRSFS_DELETE, treq,
                                     CHECK_MODE_BITS);
            }
        }
        if (code && (amode & VREAD))
-           code = afs_AccessOK(avc, PRSFS_READ, &treq, CHECK_MODE_BITS);
+           code = afs_AccessOK(avc, PRSFS_READ, treq, CHECK_MODE_BITS);
     } else {
        if (vType(avc) == VDIR) {
            if (amode & VEXEC)
                code =
-                   afs_AccessOK(avc, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS);
+                   afs_AccessOK(avc, PRSFS_LOOKUP, treq, CHECK_MODE_BITS);
            if (code && (amode & VWRITE)) {
                code =
-                   afs_AccessOK(avc, PRSFS_INSERT, &treq, CHECK_MODE_BITS);
+                   afs_AccessOK(avc, PRSFS_INSERT, treq, CHECK_MODE_BITS);
                if (!code)
                    code =
-                       afs_AccessOK(avc, PRSFS_DELETE, &treq,
+                       afs_AccessOK(avc, PRSFS_DELETE, treq,
                                     CHECK_MODE_BITS);
            }
            if (code && (amode & VREAD))
                code =
-                   afs_AccessOK(avc, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS);
+                   afs_AccessOK(avc, PRSFS_LOOKUP, treq, CHECK_MODE_BITS);
        } else {
            if (amode & VEXEC) {
-               code = afs_AccessOK(avc, PRSFS_READ, &treq, CHECK_MODE_BITS);
+               code = afs_AccessOK(avc, PRSFS_READ, treq, CHECK_MODE_BITS);
                if (code) {
                        if ((avc->f.m.Mode & 0100) == 0)
                            code = 0;
@@ -301,7 +308,7 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode,
                    code = 1;
            }
            if (code && (amode & VWRITE)) {
-               code = afs_AccessOK(avc, PRSFS_WRITE, &treq, CHECK_MODE_BITS);
+               code = afs_AccessOK(avc, PRSFS_WRITE, treq, CHECK_MODE_BITS);
 
                /* The above call fails when the NFS translator tries to copy
                 ** a file with r--r--r-- permissions into a directory which
@@ -313,11 +320,11 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode,
                if (!code && AFS_NFSXLATORREQ(acred)
                    && avc->f.m.Owner == ANONYMOUSID)
                    code =
-                       afs_AccessOK(avc, PRSFS_WRITE, &treq,
+                       afs_AccessOK(avc, PRSFS_WRITE, treq,
                                     DONT_CHECK_MODE_BITS);
            }
            if (code && (amode & VREAD))
-               code = afs_AccessOK(avc, PRSFS_READ, &treq, CHECK_MODE_BITS);
+               code = afs_AccessOK(avc, PRSFS_READ, treq, CHECK_MODE_BITS);
        }
     }
     afs_PutFakeStat(&fakestate);
@@ -325,9 +332,11 @@ afs_access(OSI_VC_DECL(avc), afs_int32 amode,
     AFS_DISCON_UNLOCK();
     
     if (code) {
+       afs_DestroyReq(treq);
        return 0;               /* if access is ok */
     } else {
-       code = afs_CheckCode(EACCES, &treq, 17);        /* failure code */
+       code = afs_CheckCode(EACCES, treq, 17); /* failure code */
+       afs_DestroyReq(treq);
        return code;
     }
 }
@@ -342,18 +351,21 @@ afs_getRights(OSI_VC_DECL(avc), afs_int32 arights,
              afs_ucred_t *acred)
 {
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     OSI_VC_CONVERT(avc);
 
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
 
-    code = afs_VerifyVCache(avc, &treq);
+    code = afs_VerifyVCache(avc, treq);
     if (code) {
-       code = afs_CheckCode(code, &treq, 16);
+       code = afs_CheckCode(code, treq, 16);
+       afs_DestroyReq(treq);
        return code;
     }
 
-    return afs_GetAccessBits(avc, arights, &treq);
+    code = afs_GetAccessBits(avc, arights, treq);
+    afs_DestroyReq(treq);
+    return code;
 }
 #endif /* defined(UKERNEL) */
index d01aff2f2d772347914fd736ba1142e46af11cf7..74b3bbb276ee5562d4bdb317a2b7c8c3492207df 100644 (file)
@@ -194,7 +194,7 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, afs_ucred_t *acred)
 #endif
 {
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     struct unixuser *au;
     int inited = 0;
     OSI_VC_CONVERT(avc);
@@ -205,19 +205,23 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, afs_ucred_t *acred)
 
     if (afs_fakestat_enable && avc->mvstat == 1) {
        struct afs_fakestat_state fakestat;
+       struct vrequest *ureq = NULL;
 
-       code = afs_InitReq(&treq, acred);
-       if (code)
+       code = afs_CreateReq(&ureq, acred);
+       if (code) {
            return code;
+       }
        afs_InitFakeStat(&fakestat);
-       code = afs_TryEvalFakeStat(&avc, &fakestat, &treq);
+       code = afs_TryEvalFakeStat(&avc, &fakestat, ureq);
        if (code) {
            afs_PutFakeStat(&fakestat);
+           afs_DestroyReq(ureq);
            return code;
        }
 
        code = afs_CopyOutAttrs(avc, attrs);
        afs_PutFakeStat(&fakestat);
+       afs_DestroyReq(ureq);
        return code;
     }
 #if defined(AFS_SUN5_ENV)
@@ -243,8 +247,8 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, afs_ucred_t *acred)
        return EIO;
 
     if (!(avc->f.states & CStatd)) {
-       if (!(code = afs_InitReq(&treq, acred))) {
-           code = afs_VerifyVCache2(avc, &treq);
+       if (!(code = afs_CreateReq(&treq, acred))) {
+           code = afs_VerifyVCache2(avc, treq);
            inited = 1;
        }
     } else
@@ -263,19 +267,21 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, afs_ucred_t *acred)
 
        if (afs_nfsexporter) {
            if (!inited) {
-               if ((code = afs_InitReq(&treq, acred)))
+               if ((code = afs_CreateReq(&treq, acred))) {
                    return code;
+               }
                inited = 1;
            }
            if (AFS_NFSXLATORREQ(acred)) {
                if ((vType(avc) != VDIR)
-                   && !afs_AccessOK(avc, PRSFS_READ, &treq,
+                   && !afs_AccessOK(avc, PRSFS_READ, treq,
                                     CHECK_MODE_BITS |
                                     CMB_ALLOW_EXEC_AS_READ)) {
+                   afs_DestroyReq(treq);
                    return EACCES;
                }
            }
-           if ((au = afs_FindUser(treq.uid, -1, READ_LOCK))) {
+           if ((au = afs_FindUser(treq->uid, -1, READ_LOCK))) {
                struct afs_exporter *exporter = au->exporter;
 
                if (exporter && !(afs_nfsexporter->exp_states & EXP_UNIXMODE)) {
@@ -336,9 +342,12 @@ afs_getattr(OSI_VC_DECL(avc), struct vattr *attrs, afs_ucred_t *acred)
 
     AFS_DISCON_UNLOCK();
 
-    if (!code)
+    if (!code) {
+       afs_DestroyReq(treq);
        return 0;
-    code = afs_CheckCode(code, &treq, 14);
+    }
+    code = afs_CheckCode(code, treq, 14);
+    afs_DestroyReq(treq);
     return code;
 }
 
@@ -450,7 +459,7 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
            afs_ucred_t *acred)
 #endif
 {
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     struct AFSStoreStatus astat;
     afs_int32 code;
 #if defined(AFS_FBSD_ENV) || defined(AFS_DFBSD_ENV)
@@ -471,13 +480,13 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
               ICL_HANDLE_OFFSET(attrs->va_size), ICL_TYPE_OFFSET,
               ICL_HANDLE_OFFSET(avc->f.m.Length));
 #endif
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
 
     AFS_DISCON_LOCK();
 
     afs_InitFakeStat(&fakestate);
-    code = afs_EvalFakeStat(&avc, &fakestate, &treq);
+    code = afs_EvalFakeStat(&avc, &fakestate, treq);
     if (code)
        goto done;
 
@@ -509,7 +518,7 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
 #else
     if (attrs->va_size != ~0) {
 #endif
-       if (!afs_AccessOK(avc, PRSFS_WRITE, &treq, DONT_CHECK_MODE_BITS)) {
+       if (!afs_AccessOK(avc, PRSFS_WRITE, treq, DONT_CHECK_MODE_BITS)) {
            code = EACCES;
            goto done;
        }
@@ -554,9 +563,9 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
         if (AFS_IS_DISCONNECTED && tsize >=avc->f.m.Length) {
            /* If we're growing the file, and we're disconnected, we need
             * to make the relevant dcache chunks appear ourselves. */
-           code = afs_ExtendSegments(avc, tsize, &treq);
+           code = afs_ExtendSegments(avc, tsize, treq);
        } else {
-           code = afs_TruncateAllSegments(avc, tsize, &treq, acred);
+           code = afs_TruncateAllSegments(avc, tsize, treq, acred);
        }
 #ifdef AFS_LINUX26_ENV
        /* We must update the Linux kernel's idea of file size as soon as
@@ -582,7 +591,7 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
                /* Store files now if not disconnected. */
                /* XXX: AFS_IS_DISCON_RW handled. */
                if (!AFS_IS_DISCONNECTED) {
-                       code = afs_StoreAllSegments(avc, &treq, AFS_ASYNC);
+                       code = afs_StoreAllSegments(avc, treq, AFS_ASYNC);
                        if (!code)
                                avc->f.states &= ~CDirty;
                }
@@ -598,7 +607,7 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
     if (!AFS_IS_DISCONNECTED) {
         if (code == 0) {
            ObtainSharedLock(&avc->lock, 16);   /* lock entry */
-           code = afs_WriteVCache(avc, &astat, &treq); /* send request */
+           code = afs_WriteVCache(avc, &astat, treq);  /* send request */
            ReleaseSharedLock(&avc->lock);      /* release lock */
         }
         if (code) {
@@ -632,6 +641,7 @@ afs_setattr(OSI_VC_DECL(avc), struct vattr *attrs,
     afs_PutFakeStat(&fakestate);
 
     AFS_DISCON_UNLOCK();
-    code = afs_CheckCode(code, &treq, 15);
+    code = afs_CheckCode(code, treq, 15);
+    afs_DestroyReq(treq);
     return code;
 }
index a3d612862d971b96b3302b10da07a5529ba2012a..fc8701861bd51298866db0ed69138c0247f6e8a3 100644 (file)
@@ -41,7 +41,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
 #endif                         /* AFS_SGI64_ENV */
 {
     afs_int32 origCBs, origZaps, finalZaps;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     afs_int32 code;
     struct afs_conn *tc;
     struct VenusFid newFid;
@@ -65,7 +65,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     OutFidStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
     OutDirStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
 
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        goto done2;
 
     afs_Trace3(afs_iclSetp, CM_TRACE_CREATE, ICL_TYPE_POINTER, adp,
@@ -108,11 +108,11 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     }
     AFS_DISCON_LOCK();
 
-    code = afs_EvalFakeStat(&adp, &fakestate, &treq);
+    code = afs_EvalFakeStat(&adp, &fakestate, treq);
     if (code)
        goto done;
   tagain:
-    code = afs_VerifyVCache(adp, &treq);
+    code = afs_VerifyVCache(adp, treq);
     if (code)
        goto done;
 
@@ -129,7 +129,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
         goto done;
     }
 
-    tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1);
+    tdc = afs_GetDCache(adp, (afs_size_t) 0, treq, &offset, &len, 1);
     ObtainWriteLock(&adp->lock, 135);
     if (tdc)
        ObtainSharedLock(&tdc->lock, 630);
@@ -168,10 +168,10 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
            newFid.Fid.Volume = adp->f.fid.Fid.Volume;
            tvc = NULL;
            if (newFid.Fid.Unique == 0) {
-               tvc = afs_LookupVCache(&newFid, &treq, NULL, adp, aname);
+               tvc = afs_LookupVCache(&newFid, treq, NULL, adp, aname);
            }
            if (!tvc)           /* lookup failed or wasn't called */
-               tvc = afs_GetVCache(&newFid, &treq, NULL, NULL);
+               tvc = afs_GetVCache(&newFid, treq, NULL, NULL);
 
            if (tvc) {
                /* if the thing exists, we need the right access to open it.
@@ -184,7 +184,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
                 * has mode -w-w-w, which is wrong.
                 */
                if ((amode & VREAD)
-                   && !afs_AccessOK(tvc, PRSFS_READ, &treq, CHECK_MODE_BITS)) {
+                   && !afs_AccessOK(tvc, PRSFS_READ, treq, CHECK_MODE_BITS)) {
                    afs_PutVCache(tvc);
                    code = EACCES;
                    goto done;
@@ -202,7 +202,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
                    tvc->f.parent.unique = adp->f.fid.Fid.Unique;
                    /* need write mode for these guys */
                    if (!afs_AccessOK
-                       (tvc, PRSFS_WRITE, &treq, CHECK_MODE_BITS)) {
+                       (tvc, PRSFS_WRITE, treq, CHECK_MODE_BITS)) {
                        afs_PutVCache(tvc);
                        code = EACCES;
                        goto done;
@@ -301,7 +301,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
 
        InStatus.UnixModeBits = attrs->va_mode & 0xffff;        /* only care about protection bits */
        do {
-         tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn);
+           tc = afs_Conn(&adp->f.fid, treq, SHARED_LOCK, &rxconn);
            if (tc) {
                hostp = tc->srvr->server;       /* remember for callback processing */
                now = osi_Time();
@@ -318,7 +318,7 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
            } else
                code = -1;
        } while (afs_Analyze
-                (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_CREATEFILE,
+                (tc, rxconn, code, &adp->f.fid, treq, AFS_STATS_FS_RPCIDX_CREATEFILE,
                  SHARED_LOCK, NULL));
 
        if ((code == EEXIST || code == UAEEXIST) &&
@@ -455,9 +455,9 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
            ReleaseWriteLock(&afs_xcbhash);
            if (AFS_IS_DISCON_RW) {
                afs_DisconAddDirty(tvc, VDisconCreate, 0);
-               afs_GenDisconStatus(adp, tvc, &newFid, attrs, &treq, VREG);
+               afs_GenDisconStatus(adp, tvc, &newFid, attrs, treq, VREG);
            } else {
-               afs_ProcessFS(tvc, OutFidStatus, &treq);
+               afs_ProcessFS(tvc, OutFidStatus, treq);
            }
 
            tvc->f.parent.vnode = adp->f.fid.Fid.Vnode;
@@ -498,7 +498,8 @@ afs_create(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     }
 
     afs_PutFakeStat(&fakestate);
-    code = afs_CheckCode(code, &treq, 20);
+    code = afs_CheckCode(code, treq, 20);
+    afs_DestroyReq(treq);
 
   done2:
     osi_FreeSmallSpace(OutFidStatus);
index e284222cdb61d127d716173564952b11e34a394d..8b49a68a04219a58936071f936a980ac4b82b784 100644 (file)
@@ -37,7 +37,7 @@ int
 afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs, 
      struct vcache **avcp, afs_ucred_t *acred)
 {
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     afs_int32 code;
     struct afs_conn *tc;
     struct rx_connection *rxconn;
@@ -62,7 +62,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     OutFidStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
     OutDirStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
 
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        goto done2;
     afs_InitFakeStat(&fakestate);
 
@@ -78,10 +78,10 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     
     AFS_DISCON_LOCK();
 
-    code = afs_EvalFakeStat(&adp, &fakestate, &treq);
+    code = afs_EvalFakeStat(&adp, &fakestate, treq);
     if (code)
        goto done;
-    code = afs_VerifyVCache(adp, &treq);
+    code = afs_VerifyVCache(adp, treq);
     if (code)
        goto done;
 
@@ -102,12 +102,12 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     InStatus.ClientModTime = osi_Time();
     InStatus.UnixModeBits = attrs->va_mode & 0xffff;   /* only care about protection bits */
     InStatus.Group = (afs_int32) afs_cr_gid(acred);
-    tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1);
+    tdc = afs_GetDCache(adp, (afs_size_t) 0, treq, &offset, &len, 1);
     ObtainWriteLock(&adp->lock, 153);
 
     if (!AFS_IS_DISCON_RW) {
        do {
-         tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn);
+           tc = afs_Conn(&adp->f.fid, treq, SHARED_LOCK, &rxconn);
            if (tc) {
                XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_MAKEDIR);
                now = osi_Time();
@@ -129,7 +129,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
            } else
                code = -1;
        } while (afs_Analyze
-                (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_MAKEDIR,
+                (tc, rxconn, code, &adp->f.fid, treq, AFS_STATS_FS_RPCIDX_MAKEDIR,
                     SHARED_LOCK, NULL));
 
        if (code) {
@@ -202,12 +202,12 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
        }
 
        ObtainWriteLock(&tvc->lock, 738);
-       afs_GenDisconStatus(adp, tvc, &newFid, attrs, &treq, VDIR);
+       afs_GenDisconStatus(adp, tvc, &newFid, attrs, treq, VDIR);
        ReleaseWriteLock(&tvc->lock);
 
        /* And now make an empty dir, containing . and .. : */
        /* Get a new dcache for it first. */
-       new_dc = afs_GetDCache(tvc, (afs_size_t) 0, &treq, &offset, &len, 1);
+       new_dc = afs_GetDCache(tvc, (afs_size_t) 0, treq, &offset, &len, 1);
        if (!new_dc) {
            /* printf("afs_mkdir: can't get new dcache for dir.\n"); */
            code = ENOENT;
@@ -231,7 +231,7 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
        ReleaseWriteLock(&tvc->lock);
     } else {
        /* now we're done with parent dir, create the real dir's cache entry */
-       tvc = afs_GetVCache(&newFid, &treq, NULL, NULL);
+       tvc = afs_GetVCache(&newFid, treq, NULL, NULL);
        if (tvc) {
            code = 0;
            *avcp = tvc;
@@ -243,7 +243,8 @@ afs_mkdir(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     AFS_DISCON_UNLOCK();
   done3:
     afs_PutFakeStat(&fakestate);
-    code = afs_CheckCode(code, &treq, 26);
+    code = afs_CheckCode(code, treq, 26);
+    afs_DestroyReq(treq);
   done2:
     osi_FreeSmallSpace(OutFidStatus);
     osi_FreeSmallSpace(OutDirStatus);
@@ -260,7 +261,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, struct vnode *cdirp,
 afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
 #endif
 {
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     struct dcache *tdc;
     struct vcache *tvc = NULL;
     afs_int32 code;
@@ -278,7 +279,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
     afs_Trace2(afs_iclSetp, CM_TRACE_RMDIR, ICL_TYPE_POINTER, adp,
               ICL_TYPE_STRING, aname);
 
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        goto done2;
     afs_InitFakeStat(&fakestate);
 
@@ -289,11 +290,11 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
 
     AFS_DISCON_LOCK();
 
-    code = afs_EvalFakeStat(&adp, &fakestate, &treq);
+    code = afs_EvalFakeStat(&adp, &fakestate, treq);
     if (code)
        goto done;
 
-    code = afs_VerifyVCache(adp, &treq);
+    code = afs_VerifyVCache(adp, treq);
     if (code)
        goto done;
 
@@ -311,7 +312,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
         goto done;
     }
 
-    tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); /* test for error below */
+    tdc = afs_GetDCache(adp, (afs_size_t) 0, treq, &offset, &len, 1);  /* test for error below */
     ObtainWriteLock(&adp->lock, 154);
     if (tdc)
        ObtainSharedLock(&tdc->lock, 633);
@@ -327,7 +328,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
            unlinkFid.Fid.Volume = adp->f.fid.Fid.Volume;
            if (unlinkFid.Fid.Unique == 0) {
                tvc =
-                   afs_LookupVCache(&unlinkFid, &treq, &cached, adp, aname);
+                   afs_LookupVCache(&unlinkFid, treq, &cached, adp, aname);
            } else {
                ObtainReadLock(&afs_xvcache);
                tvc = afs_FindVCache(&unlinkFid, 0, 1 /* do xstats */ );
@@ -339,7 +340,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
     if (!AFS_IS_DISCON_RW) {
        /* Not disconnected, can connect to server. */
        do {
-         tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn);
+           tc = afs_Conn(&adp->f.fid, treq, SHARED_LOCK, &rxconn);
            if (tc) {
                XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_REMOVEDIR);
                RX_AFS_GUNLOCK();
@@ -354,7 +355,7 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
            } else
                code = -1;
        } while (afs_Analyze
-                (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_REMOVEDIR,
+                (tc, rxconn, code, &adp->f.fid, treq, AFS_STATS_FS_RPCIDX_REMOVEDIR,
                 SHARED_LOCK, NULL));
 
        if (code) {
@@ -474,7 +475,8 @@ afs_rmdir(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
   done:
     AFS_DISCON_UNLOCK();
     afs_PutFakeStat(&fakestate);
-    code = afs_CheckCode(code, &treq, 27);
+    code = afs_CheckCode(code, treq, 27);
+    afs_DestroyReq(treq);
   done2:
     return code;
 }
index e330a0d6bad332088ed023e75b43ae4cb84902d7..56c37c82a62024f328516d240863a579bb1e5bb6 100644 (file)
@@ -576,18 +576,18 @@ int afs_lockctl(struct vcache * avc, struct AFS_FLOCK * af, int acmd,
                afs_ucred_t * acred)
 #endif
 {
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     afs_int32 code;
     struct afs_fakestat_state fakestate;
 
     AFS_STATCNT(afs_lockctl);
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
     afs_InitFakeStat(&fakestate);
 
     AFS_DISCON_LOCK();
 
-    code = afs_EvalFakeStat(&avc, &fakestate, &treq);
+    code = afs_EvalFakeStat(&avc, &fakestate, treq);
     if (code) {
        goto done;
     }
@@ -600,8 +600,8 @@ int afs_lockctl(struct vcache * avc, struct AFS_FLOCK * af, int acmd,
            code = 0;
            goto done;
        }
-       code = HandleGetLock(avc, af, &treq, clid);
-       code = afs_CheckCode(code, &treq, 2);   /* defeat buggy AIX optimz */
+       code = HandleGetLock(avc, af, treq, clid);
+       code = afs_CheckCode(code, treq, 2);    /* defeat buggy AIX optimz */
        goto done;
     } else if ((acmd == F_SETLK) || (acmd == F_SETLKW)
 #if (defined(AFS_SGI_ENV) || defined(AFS_SUN5_ENV)) && !defined(AFS_SUN58_ENV)
@@ -649,21 +649,22 @@ int afs_lockctl(struct vcache * avc, struct AFS_FLOCK * af, int acmd,
        ) && code != LOCK_UN)
        code |= LOCK_NB;        /* non-blocking, s.v.p. */
 #if defined(AFS_DARWIN_ENV)
-    code = HandleFlock(avc, code, &treq, clid, 0 /*!onlymine */ );
+    code = HandleFlock(avc, code, treq, clid, 0 /*!onlymine */ );
 #elif defined(AFS_SGI_ENV)
     AFS_RWLOCK((vnode_t *) avc, VRWLOCK_WRITE);
-    code = HandleFlock(avc, code, &treq, clid, 0 /*!onlymine */ );
+    code = HandleFlock(avc, code, treq, clid, 0 /*!onlymine */ );
     AFS_RWUNLOCK((vnode_t *) avc, VRWLOCK_WRITE);
 #else
-    code = HandleFlock(avc, code, &treq, 0, 0 /*!onlymine */ );
+    code = HandleFlock(avc, code, treq, 0, 0 /*!onlymine */ );
 #endif
-    code = afs_CheckCode(code, &treq, 3);      /* defeat AIX -O bug */
+    code = afs_CheckCode(code, treq, 3);       /* defeat AIX -O bug */
     goto done;
     }
     code = EINVAL;
 done:
     afs_PutFakeStat(&fakestate);
     AFS_DISCON_UNLOCK();
+    afs_DestroyReq(treq);
     return code;
 }
 
index 9a62ccc36e174e722a5a82690ace34461a4e8846..2a8844348b1315fd826a2b55d90bb35249cdabda 100644 (file)
@@ -38,7 +38,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname,
         afs_ucred_t *acred)
 #endif
 {
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     struct dcache *tdc;
     afs_int32 code;
     struct afs_conn *tc;
@@ -58,7 +58,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname,
     OutDirStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
 
     /* create a hard link; new entry is aname in dir adp */
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        goto done2;
 
     afs_InitFakeStat(&vfakestate);
@@ -66,10 +66,10 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname,
 
     AFS_DISCON_LOCK();
 
-    code = afs_EvalFakeStat(&avc, &vfakestate, &treq);
+    code = afs_EvalFakeStat(&avc, &vfakestate, treq);
     if (code)
        goto done;
-    code = afs_EvalFakeStat(&adp, &dfakestate, &treq);
+    code = afs_EvalFakeStat(&adp, &dfakestate, treq);
     if (code)
        goto done;
 
@@ -82,7 +82,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname,
        code = ENAMETOOLONG;
        goto done;
     }
-    code = afs_VerifyVCache(adp, &treq);
+    code = afs_VerifyVCache(adp, treq);
     if (code)
        goto done;
 
@@ -99,10 +99,10 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname,
         goto done;
     }
 
-    tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); /* test for error below */
+    tdc = afs_GetDCache(adp, (afs_size_t) 0, treq, &offset, &len, 1);  /* test for error below */
     ObtainWriteLock(&adp->lock, 145);
     do {
-       tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn);
+       tc = afs_Conn(&adp->f.fid, treq, SHARED_LOCK, &rxconn);
        if (tc) {
            XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_LINK);
            RX_AFS_GUNLOCK();
@@ -116,7 +116,7 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname,
        } else
            code = -1;
     } while (afs_Analyze
-            (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_LINK,
+            (tc, rxconn, code, &adp->f.fid, treq, AFS_STATS_FS_RPCIDX_LINK,
              SHARED_LOCK, NULL));
 
     if (code) {
@@ -167,7 +167,8 @@ afs_link(struct vcache *avc, OSI_VC_DECL(adp), char *aname,
     ReleaseWriteLock(&avc->lock);
     code = 0;
   done:
-    code = afs_CheckCode(code, &treq, 24);
+    code = afs_CheckCode(code, treq, 24);
+    afs_DestroyReq(treq);
     afs_PutFakeStat(&vfakestate);
     afs_PutFakeStat(&dfakestate);
     AFS_DISCON_UNLOCK();
index 5d96f75c10f191401bafe8b56b57c20a070a75ab..60462a1c1ec14c37481e8b0933d22156cfce99d3 100644 (file)
@@ -1376,7 +1376,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
 afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acred)
 #endif
 {
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     char *tname = NULL;
     struct vcache *tvc = 0;
     afs_int32 code;
@@ -1396,8 +1396,8 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
     afs_InitFakeStat(&fakestate);
 
     AFS_DISCON_LOCK();
-    
-    if ((code = afs_InitReq(&treq, acred)))
+
+    if ((code = afs_CreateReq(&treq, acred)))
        goto done;
 
     if (afs_fakestat_enable && adp->mvstat == 1) {
@@ -1422,9 +1422,9 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
 #endif
 
     if (tryEvalOnly)
-       code = afs_TryEvalFakeStat(&adp, &fakestate, &treq);
+       code = afs_TryEvalFakeStat(&adp, &fakestate, treq);
     else
-       code = afs_EvalFakeStat(&adp, &fakestate, &treq);
+       code = afs_EvalFakeStat(&adp, &fakestate, treq);
 
     /*printf("Code is %d\n", code);*/
     
@@ -1443,7 +1443,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
     bulkcode = 0;
 
     if (!(adp->f.states & CStatd) && !afs_InReadDir(adp)) {
-       if ((code = afs_VerifyVCache2(adp, &treq))) {
+       if ((code = afs_VerifyVCache2(adp, treq))) {
            goto done;
        }
     } else
@@ -1458,7 +1458,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
        }
        /* otherwise we have the fid here, so we use it */
        /*printf("Getting vcache\n");*/
-       tvc = afs_GetVCache(adp->mvid, &treq, NULL, NULL);
+       tvc = afs_GetVCache(adp->mvid, treq, NULL, NULL);
        afs_Trace3(afs_iclSetp, CM_TRACE_GETVCDOTDOT, ICL_TYPE_FID, adp->mvid,
                   ICL_TYPE_POINTER, tvc, ICL_TYPE_INT32, code);
        *avcp = tvc;
@@ -1474,18 +1474,18 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
     }
 
     /* now check the access */
-    if (treq.uid != adp->last_looker) {
-       if (!afs_AccessOK(adp, PRSFS_LOOKUP, &treq, CHECK_MODE_BITS)) {
+    if (treq->uid != adp->last_looker) {
+       if (!afs_AccessOK(adp, PRSFS_LOOKUP, treq, CHECK_MODE_BITS)) {
            *avcp = NULL;
            code = EACCES;
            goto done;
        } else
-           adp->last_looker = treq.uid;
+           adp->last_looker = treq->uid;
     }
 
     /* Check for read access as well.  We need read access in order to
      * stat files, but not to stat subdirectories. */
-    if (!afs_AccessOK(adp, PRSFS_READ, &treq, CHECK_MODE_BITS))
+    if (!afs_AccessOK(adp, PRSFS_READ, treq, CHECK_MODE_BITS))
        no_read_access = 1;
 
     /* special case lookup of ".".  Can we check for it sooner in this code,
@@ -1538,7 +1538,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
        struct VenusFid tfid;
        afs_uint32 cellidx, volid, vnoid, uniq;
 
-       code = EvalMountData('%', aname, 0, 0, NULL, &treq, &cellidx, &volid, &vnoid, &uniq);
+       code = EvalMountData('%', aname, 0, 0, NULL, treq, &cellidx, &volid, &vnoid, &uniq);
        if (code)
            goto done;
        /* If a vnode was returned, it's not a real mount point */
@@ -1554,7 +1554,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
            tfid.Fid.Vnode = VNUM_FROM_TYPEID(VN_TYPE_MOUNT, cellidx << 2);
            tfid.Fid.Unique = volid;
        }
-       *avcp = tvc = afs_GetVCache(&tfid, &treq, NULL, NULL);
+       *avcp = tvc = afs_GetVCache(&tfid, treq, NULL, NULL);
        code = (tvc ? 0 : ENOENT);
        hit = 1;
        goto done;
@@ -1570,14 +1570,14 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
        struct VenusFid tfid;
 
        afs_GetDynrootMountFid(&tfid);
-       *avcp = tvc = afs_GetVCache(&tfid, &treq, NULL, NULL);
+       *avcp = tvc = afs_GetVCache(&tfid, treq, NULL, NULL);
        code = 0;
        hit = 1;
        goto done;
     }
 #endif
 
-    Check_AtSys(adp, aname, &sysState, &treq);
+    Check_AtSys(adp, aname, &sysState, treq);
     tname = sysState.name;
 
     /* 1st Check_AtSys and lookup by tname is required here, for now,
@@ -1622,7 +1622,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
        if (afs_InReadDir(adp))
            tdc = adp->dcreaddir;
        else
-           tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq,
+           tdc = afs_GetDCache(adp, (afs_size_t) 0, treq,
                                &dirOffset, &dirLen, 1);
        if (!tdc) {
            *avcp = NULL;       /* redundant, but harmless */
@@ -1687,7 +1687,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
                                 &dirCookie);
 
        /* If the first lookup doesn't succeed, maybe it's got @sys in the name */
-       while (code == ENOENT && Next_AtSys(adp, &treq, &sysState))
+       while (code == ENOENT && Next_AtSys(adp, treq, &sysState))
            code =
                afs_dir_LookupOffset(tdc, sysState.name, &tfid.Fid,
                                     &dirCookie);
@@ -1756,7 +1756,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
            } while (tvc && retry);
 
            if (!tvc || !(tvc->f.states & CStatd))
-               bulkcode = afs_DoBulkStat(adp, dirCookie, &treq);
+               bulkcode = afs_DoBulkStat(adp, dirCookie, treq);
            else
                bulkcode = 0;
 
@@ -1780,10 +1780,10 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
        if (!tvc) {
            afs_int32 cached = 0;
            if (!tfid.Fid.Unique && (adp->f.states & CForeign)) {
-               tvc = afs_LookupVCache(&tfid, &treq, &cached, adp, tname);
+               tvc = afs_LookupVCache(&tfid, treq, &cached, adp, tname);
            }
            if (!tvc && !bulkcode) {    /* lookup failed or wasn't called */
-               tvc = afs_GetVCache(&tfid, &treq, &cached, NULL);
+               tvc = afs_GetVCache(&tfid, treq, &cached, NULL);
            }
        }                       /* if !tvc */
     }                          /* sub-block just to reduce stack usage */
@@ -1799,7 +1799,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
            ObtainSharedLock(&tvc->lock, 680);
            if (!tvc->linkData) {
                UpgradeSToWLock(&tvc->lock, 681);
-               code = afs_HandleLink(tvc, &treq);
+               code = afs_HandleLink(tvc, treq);
                ConvertWToRLock(&tvc->lock);
            } else {
                ConvertSToRLock(&tvc->lock);
@@ -1821,7 +1821,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
                struct volume *tvolp;
 
                ObtainWriteLock(&tvc->lock, 133);
-               code = EvalMountPoint(tvc, adp, &tvolp, &treq);
+               code = EvalMountPoint(tvc, adp, &tvolp, treq);
                ReleaseWriteLock(&tvc->lock);
 
                if (code) {
@@ -1843,9 +1843,9 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
                    if (tvolp && (tvolp->states & VForeign)) {
                        /* XXXX tvolp has ref cnt on but not locked! XXX */
                        tvc =
-                           afs_GetRootVCache(tvc->mvid, &treq, NULL, tvolp);
+                           afs_GetRootVCache(tvc->mvid, treq, NULL, tvolp);
                    } else {
-                       tvc = afs_GetVCache(tvc->mvid, &treq, NULL, NULL);
+                       tvc = afs_GetVCache(tvc->mvid, treq, NULL, NULL);
                    }
                    afs_PutVCache(uvc); /* we're done with it */
 
@@ -1892,7 +1892,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
        if (!AFS_IS_DISCONNECTED) {
            if (pass == 0) {
                struct volume *tv;
-               tv = afs_GetVolume(&adp->f.fid, &treq, READ_LOCK);
+               tv = afs_GetVolume(&adp->f.fid, treq, READ_LOCK);
                if (tv) {
                    if (tv->states & VRO) {
                        pass = 1;       /* try this *once* */
@@ -1935,7 +1935,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
            } else {
 #ifdef AFS_LINUX20_ENV
                /* So Linux inode cache is up to date. */
-               code = afs_VerifyVCache(tvc, &treq);
+               code = afs_VerifyVCache(tvc, treq);
 #else
                afs_PutFakeStat(&fakestate);
                AFS_DISCON_UNLOCK();
@@ -1949,7 +1949,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
     if (bulkcode)
        code = bulkcode;
 
-    code = afs_CheckCode(code, &treq, 19);
+    code = afs_CheckCode(code, treq, 19);
     if (code) {
        /* If there is an error, make sure *avcp is null.
         * Alphas panic otherwise - defect 10719.
@@ -1958,6 +1958,7 @@ afs_lookup(OSI_VC_DECL(adp), char *aname, struct vcache **avcp, afs_ucred_t *acr
     }
 
     afs_PutFakeStat(&fakestate);
+    afs_DestroyReq(treq);
     AFS_DISCON_UNLOCK();
     return code;
 }
index b6532c26bfdc25d1e886578a9d31ee9286d47b5e..0c90bf16f877398da078b4a0dd22da6218052f72 100644 (file)
@@ -40,13 +40,13 @@ afs_open(struct vcache **avcp, afs_int32 aflags, afs_ucred_t *acred)
 #endif
 {
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     struct vcache *tvc;
     int writing;
     struct afs_fakestat_state fakestate;
 
     AFS_STATCNT(afs_open);
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
 #ifdef AFS_SGI64_ENV
     /* avcpp can be, but is not necesarily, bhp's vnode. */
@@ -60,10 +60,10 @@ afs_open(struct vcache **avcp, afs_int32 aflags, afs_ucred_t *acred)
 
     AFS_DISCON_LOCK();
 
-    code = afs_EvalFakeStat(&tvc, &fakestate, &treq);
+    code = afs_EvalFakeStat(&tvc, &fakestate, treq);
     if (code)
        goto done;
-    code = afs_VerifyVCache(tvc, &treq);
+    code = afs_VerifyVCache(tvc, treq);
     if (code)
        goto done;
 
@@ -90,7 +90,7 @@ afs_open(struct vcache **avcp, afs_int32 aflags, afs_ucred_t *acred)
        } else {
            if (!afs_AccessOK
                (tvc, ((tvc->f.states & CForeign) ? PRSFS_READ : PRSFS_LOOKUP),
-                &treq, CHECK_MODE_BITS)) {
+                treq, CHECK_MODE_BITS)) {
                code = EACCES;
                /* printf("afs_Open: no access for dir\n"); */
                goto done;
@@ -100,7 +100,7 @@ afs_open(struct vcache **avcp, afs_int32 aflags, afs_ucred_t *acred)
 #ifdef AFS_SUN5_ENV
        if (AFS_NFSXLATORREQ(acred) && (aflags & FREAD)) {
            if (!afs_AccessOK
-               (tvc, PRSFS_READ, &treq,
+               (tvc, PRSFS_READ, treq,
                 CHECK_MODE_BITS | CMB_ALLOW_EXEC_AS_READ)) {
                code = EACCES;
                goto done;
@@ -169,7 +169,7 @@ afs_open(struct vcache **avcp, afs_int32 aflags, afs_ucred_t *acred)
        struct dcache *tdc;
        afs_size_t offset, len;
 
-       tdc = afs_GetDCache(tvc, 0, &treq, &offset, &len, 1);
+       tdc = afs_GetDCache(tvc, 0, treq, &offset, &len, 1);
        if (tdc) {
            ObtainSharedLock(&tdc->mflock, 865);
            if (!(tdc->mflags & DFFetchReq)) {
@@ -199,7 +199,8 @@ afs_open(struct vcache **avcp, afs_int32 aflags, afs_ucred_t *acred)
     afs_PutFakeStat(&fakestate);
     AFS_DISCON_UNLOCK();
 
-    code = afs_CheckCode(code, &treq, 4);      /* avoid AIX -O bug */
+    code = afs_CheckCode(code, treq, 4);       /* avoid AIX -O bug */
+    afs_DestroyReq(treq);
 
     afs_Trace2(afs_iclSetp, CM_TRACE_OPEN, ICL_TYPE_POINTER, tvc,
               ICL_TYPE_INT32, 999999);
index 4bef4d167431c7ba2d05859196377f7aeb06d292..b0f7f0f2e5a58913eb2775b5a7b5a000808ebd23 100644 (file)
@@ -62,28 +62,31 @@ afs_MemRead(struct vcache *avc, struct uio *auio,
     struct iovec *tvec;
 #endif
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
 
     AFS_STATCNT(afs_MemRead);
     if (avc->vc_error)
        return EIO;
 
     /* check that we have the latest status info in the vnode cache */
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
     if (!noLock) {
-       code = afs_VerifyVCache(avc, &treq);
+       code = afs_VerifyVCache(avc, treq);
        if (code) {
-           code = afs_CheckCode(code, &treq, 8);       /* failed to get it */
+           code = afs_CheckCode(code, treq, 8);        /* failed to get it */
+           afs_DestroyReq(treq);
            return code;
        }
     }
 #ifndef        AFS_VM_RDWR_ENV
     if (AFS_NFSXLATORREQ(acred)) {
        if (!afs_AccessOK
-           (avc, PRSFS_READ, &treq,
+           (avc, PRSFS_READ, treq,
             CHECK_MODE_BITS | CMB_ALLOW_EXEC_AS_READ)) {
-           return afs_CheckCode(EACCES, &treq, 9);
+           code = afs_CheckCode(EACCES, treq, 9);
+           afs_DestroyReq(treq);
+           return code;
        }
     }
 #endif
@@ -186,7 +189,7 @@ afs_MemRead(struct vcache *avc, struct uio *auio,
                ReleaseReadLock(&tdc->lock);
                afs_PutDCache(tdc);     /* before reusing tdc */
            }
-           tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 2);
+           tdc = afs_GetDCache(avc, filePos, treq, &offset, &len, 2);
            ObtainReadLock(&tdc->lock);
            /* now, first try to start transfer, if we'll need the data.  If
             * data already coming, we don't need to do this, obviously.  Type
@@ -293,7 +296,7 @@ afs_MemRead(struct vcache *avc, struct uio *auio,
                 * does the FetchData rpc synchronously.
                 */
                ReleaseReadLock(&avc->lock);
-               tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 1);
+               tdc = afs_GetDCache(avc, filePos, treq, &offset, &len, 1);
                ObtainReadLock(&avc->lock);
                if (tdc)
                    ObtainReadLock(&tdc->lock);
@@ -400,7 +403,7 @@ afs_MemRead(struct vcache *avc, struct uio *auio,
            1
 #endif
            ) {
-           afs_PrefetchChunk(avc, tdc, acred, &treq);
+           afs_PrefetchChunk(avc, tdc, acred, treq);
        }
        afs_PutDCache(tdc);
     }
@@ -412,7 +415,8 @@ afs_MemRead(struct vcache *avc, struct uio *auio,
 #else
     osi_FreeSmallSpace(tvec);
 #endif
-    error = afs_CheckCode(error, &treq, 10);
+    error = afs_CheckCode(error, treq, 10);
+    afs_DestroyReq(treq);
     return error;
 }
 
@@ -519,7 +523,7 @@ afs_UFSRead(struct vcache *avc, struct uio *auio,
     struct osi_file *tfile;
     afs_int32 code;
     int trybusy = 1;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
 
     AFS_STATCNT(afs_UFSRead);
     if (avc && avc->vc_error)
@@ -528,15 +532,16 @@ afs_UFSRead(struct vcache *avc, struct uio *auio,
     AFS_DISCON_LOCK();
     
     /* check that we have the latest status info in the vnode cache */
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
     if (!noLock) {
        if (!avc)
            osi_Panic("null avc in afs_UFSRead");
        else {
-           code = afs_VerifyVCache(avc, &treq);
+           code = afs_VerifyVCache(avc, treq);
            if (code) {
-               code = afs_CheckCode(code, &treq, 11);  /* failed to get it */
+               code = afs_CheckCode(code, treq, 11);   /* failed to get it */
+               afs_DestroyReq(treq);
                AFS_DISCON_UNLOCK();
                return code;
            }
@@ -545,10 +550,12 @@ afs_UFSRead(struct vcache *avc, struct uio *auio,
 #ifndef        AFS_VM_RDWR_ENV
     if (AFS_NFSXLATORREQ(acred)) {
        if (!afs_AccessOK
-           (avc, PRSFS_READ, &treq,
+           (avc, PRSFS_READ, treq,
             CHECK_MODE_BITS | CMB_ALLOW_EXEC_AS_READ)) {
            AFS_DISCON_UNLOCK();
-           return afs_CheckCode(EACCES, &treq, 12);
+           code = afs_CheckCode(EACCES, treq, 12);
+           afs_DestroyReq(treq);
+           return code;
        }
     }
 #endif
@@ -646,7 +653,7 @@ afs_UFSRead(struct vcache *avc, struct uio *auio,
                ReleaseReadLock(&tdc->lock);
                afs_PutDCache(tdc);     /* before reusing tdc */
            }
-           tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 2);
+           tdc = afs_GetDCache(avc, filePos, treq, &offset, &len, 2);
            if (!tdc) {
                error = ENETDOWN;
                break;
@@ -755,7 +762,7 @@ afs_UFSRead(struct vcache *avc, struct uio *auio,
                 * does the FetchData rpc synchronously.
                 */
                ReleaseReadLock(&avc->lock);
-               tdc = afs_GetDCache(avc, filePos, &treq, &offset, &len, 1);
+               tdc = afs_GetDCache(avc, filePos, treq, &offset, &len, 1);
                ObtainReadLock(&avc->lock);
                if (tdc)
                    ObtainReadLock(&tdc->lock);
@@ -955,7 +962,7 @@ afs_UFSRead(struct vcache *avc, struct uio *auio,
        /* try to queue prefetch, if needed */
        if (!noLock) {
            if (!(tdc->mflags & DFNextStarted))
-               afs_PrefetchChunk(avc, tdc, acred, &treq);
+               afs_PrefetchChunk(avc, tdc, acred, treq);
        }
 #endif
        afs_PutDCache(tdc);
@@ -970,6 +977,7 @@ afs_UFSRead(struct vcache *avc, struct uio *auio,
     osi_FreeSmallSpace(tvec);
 #endif
     AFS_DISCON_UNLOCK();
-    error = afs_CheckCode(error, &treq, 13);
+    error = afs_CheckCode(error, treq, 13);
+    afs_DestroyReq(treq);
     return error;
 }
index f3dc39bde6dc589000cd16f7946430ee426863df..a76ed29e07fec5d013720ffae580cf5e4a583356 100644 (file)
@@ -581,7 +581,7 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred)
 #endif
 #endif
 {
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     struct dcache *tdc;
     afs_size_t origOffset, tlen;
     afs_int32 len;
@@ -644,7 +644,7 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred)
        return EFBIG;
 #endif
 
-    if ((code = afs_InitReq(&treq, acred))) {
+    if ((code = afs_CreateReq(&treq, acred))) {
 #ifdef AFS_HPUX_ENV
        osi_FreeSmallSpace((char *)sdirEntry);
 #endif
@@ -655,15 +655,15 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred)
 
     AFS_DISCON_LOCK();
 
-    code = afs_EvalFakeStat(&avc, &fakestate, &treq);
+    code = afs_EvalFakeStat(&avc, &fakestate, treq);
     if (code)
        goto done;
   tagain:
-    code = afs_VerifyVCache(avc, &treq);
+    code = afs_VerifyVCache(avc, treq);
     if (code)
        goto done;
     /* get a reference to the entire directory */
-    tdc = afs_GetDCache(avc, (afs_size_t) 0, &treq, &origOffset, &tlen, 1);
+    tdc = afs_GetDCache(avc, (afs_size_t) 0, treq, &origOffset, &tlen, 1);
     len = tlen;
     if (!tdc) {
        code = ENOENT;
@@ -922,7 +922,8 @@ afs_readdir(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred)
 #endif
     AFS_DISCON_UNLOCK();
     afs_PutFakeStat(&fakestate);
-    code = afs_CheckCode(code, &treq, 28);
+    code = afs_CheckCode(code, treq, 28);
+    afs_DestroyReq(treq);
     return code;
 }
 
index 308f8f39e07dda6c941879e112c1175439154bc2..3e62781b5bff883a8e8a177d9bd811d3531ae2b2 100644 (file)
@@ -176,7 +176,7 @@ char *Tnam1;
 int
 afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
 {
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     struct dcache *tdc;
     struct VenusFid unlinkFid;
     afs_int32 code;
@@ -190,13 +190,13 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
               ICL_TYPE_STRING, aname);
 
 
-    if ((code = afs_InitReq(&treq, acred))) {
+    if ((code = afs_CreateReq(&treq, acred))) {
        return code;
     }
 
     afs_InitFakeStat(&fakestate);
     AFS_DISCON_LOCK();
-    code = afs_EvalFakeStat(&adp, &fakestate, &treq);
+    code = afs_EvalFakeStat(&adp, &fakestate, treq);
     if (code)
        goto done;
 
@@ -215,10 +215,10 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
        goto done;
     }
   tagain:
-    code = afs_VerifyVCache(adp, &treq);
+    code = afs_VerifyVCache(adp, treq);
     tvc = NULL;
     if (code) {
-       code = afs_CheckCode(code, &treq, 23);
+       code = afs_CheckCode(code, treq, 23);
        goto done;
     }
 
@@ -236,7 +236,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
        goto done;
     }
     
-    tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1); /* test for error below */
+    tdc = afs_GetDCache(adp, (afs_size_t) 0, treq, &offset, &len, 1);  /* test for error below */
     ObtainWriteLock(&adp->lock, 142);
     if (tdc)
        ObtainSharedLock(&tdc->lock, 638);
@@ -272,7 +272,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
                unlinkFid.Fid.Volume = adp->f.fid.Fid.Volume;
                if (unlinkFid.Fid.Unique == 0) {
                    tvc =
-                       afs_LookupVCache(&unlinkFid, &treq, &cached, adp,
+                       afs_LookupVCache(&unlinkFid, treq, &cached, adp,
                                         aname);
                } else {
                    ObtainReadLock(&afs_xvcache);
@@ -316,7 +316,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
        if (tdc)
            ReleaseSharedLock(&tdc->lock);
        ObtainWriteLock(&tvc->lock, 143);
-       FetchWholeEnchilada(tvc, &treq);
+       FetchWholeEnchilada(tvc, treq);
        ReleaseWriteLock(&tvc->lock);
        ObtainWriteLock(&adp->lock, 144);
        /* Technically I don't think we need this back, but let's hold it 
@@ -350,7 +350,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
        ReleaseWriteLock(&adp->lock);
        if (tdc)
            ReleaseSharedLock(&tdc->lock);
-       code = afsrename(adp, aname, adp, unlname, acred, &treq);
+       code = afsrename(adp, aname, adp, unlname, acred, treq);
        Tnam1 = unlname;
        if (!code) {
            struct VenusFid *oldmvid = NULL;
@@ -378,7 +378,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
            afs_PutDCache(tdc);
        afs_PutVCache(tvc);
     } else {
-       code = afsremove(adp, tdc, tvc, aname, acred, &treq);
+       code = afsremove(adp, tdc, tvc, aname, acred, treq);
     }
     done:
     afs_PutFakeStat(&fakestate);
@@ -388,6 +388,7 @@ afs_remove(OSI_VC_DECL(adp), char *aname, afs_ucred_t *acred)
     osi_Assert(!WriteLocked(&adp->lock) || (adp->lock.pid_writer != MyPidxx));
 #endif
     AFS_DISCON_UNLOCK();
+    afs_DestroyReq(treq);
     return code;
 }
 
@@ -403,7 +404,6 @@ afs_remunlink(struct vcache *avc, int doit)
     afs_ucred_t *cred;
     char *unlname;
     struct vcache *adp;
-    struct vrequest treq;
     struct VenusFid dirFid;
     struct dcache *tdc;
     afs_int32 code = 0;
@@ -418,7 +418,9 @@ afs_remunlink(struct vcache *avc, int doit)
 #endif
 
     if (avc->mvid && (doit || (avc->f.states & CUnlinkedDel))) {
-       if ((code = afs_InitReq(&treq, avc->uncred))) {
+       struct vrequest *treq = NULL;
+
+       if ((code = afs_CreateReq(&treq, avc->uncred))) {
            ReleaseWriteLock(&avc->lock);
        } else {
            /* Must bump the refCount because GetVCache may block.
@@ -446,7 +448,7 @@ afs_remunlink(struct vcache *avc, int doit)
            dirFid.Fid.Volume = avc->f.fid.Fid.Volume;
            dirFid.Fid.Vnode = avc->f.parent.vnode;
            dirFid.Fid.Unique = avc->f.parent.unique;
-           adp = afs_GetVCache(&dirFid, &treq, NULL, NULL);
+           adp = afs_GetVCache(&dirFid, treq, NULL, NULL);
 
            if (adp) {
                tdc = afs_FindDCache(adp, (afs_size_t) 0);
@@ -455,7 +457,7 @@ afs_remunlink(struct vcache *avc, int doit)
                    ObtainSharedLock(&tdc->lock, 639);
 
                /* afsremove releases the adp & tdc locks, and does vn_rele(avc) */
-               code = afsremove(adp, tdc, avc, unlname, cred, &treq);
+               code = afsremove(adp, tdc, avc, unlname, cred, treq);
                afs_PutVCache(adp);
            } else {
                /* we failed - and won't be back to try again. */
@@ -463,6 +465,7 @@ afs_remunlink(struct vcache *avc, int doit)
            }
            osi_FreeSmallSpace(unlname);
            crfree(cred);
+           afs_DestroyReq(treq);
        }
     } else {
 #if defined(AFS_DARWIN80_ENV)
index 8dbc70e3e02a879bdc05e530f6f2617a96afbfa8..468555a370ee686c01e635ae5240f5668ab9e413 100644 (file)
@@ -454,30 +454,32 @@ afs_rename(OSI_VC_DECL(aodp), char *aname1, struct vcache *andp, char *aname2, a
     afs_int32 code;
     struct afs_fakestat_state ofakestate;
     struct afs_fakestat_state nfakestate;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     OSI_VC_CONVERT(aodp);
 
-    code = afs_InitReq(&treq, acred);
+    code = afs_CreateReq(&treq, acred);
     if (code)
        return code;
+
     afs_InitFakeStat(&ofakestate);
     afs_InitFakeStat(&nfakestate);
 
     AFS_DISCON_LOCK();
     
-    code = afs_EvalFakeStat(&aodp, &ofakestate, &treq);
+    code = afs_EvalFakeStat(&aodp, &ofakestate, treq);
     if (code)
        goto done;
-    code = afs_EvalFakeStat(&andp, &nfakestate, &treq);
+    code = afs_EvalFakeStat(&andp, &nfakestate, treq);
     if (code)
        goto done;
-    code = afsrename(aodp, aname1, andp, aname2, acred, &treq);
+    code = afsrename(aodp, aname1, andp, aname2, acred, treq);
   done:
     afs_PutFakeStat(&ofakestate);
     afs_PutFakeStat(&nfakestate);
 
     AFS_DISCON_UNLOCK();
     
-    code = afs_CheckCode(code, &treq, 25);
+    code = afs_CheckCode(code, treq, 25);
+    afs_DestroyReq(treq);
     return code;
 }
index e83b420851bbc791718da9b50d5b88ea691d75d6..993d5ac43d8b3da21e5515f3462c7163a1c89ed8 100644 (file)
@@ -69,7 +69,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
            char *atargetName, struct vcache **tvcp, afs_ucred_t *acred)
 {
     afs_uint32 now = 0;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     afs_int32 code = 0;
     struct afs_conn *tc;
     struct VenusFid newFid;
@@ -95,14 +95,14 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     OutFidStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
     OutDirStatus = osi_AllocSmallSpace(sizeof(struct AFSFetchStatus));
 
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        goto done2;
 
     afs_InitFakeStat(&fakestate);
 
     AFS_DISCON_LOCK();
     
-    code = afs_EvalFakeStat(&adp, &fakestate, &treq);
+    code = afs_EvalFakeStat(&adp, &fakestate, treq);
     if (code)
        goto done;
 
@@ -120,9 +120,9 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
        goto done;
     }
 
-    code = afs_VerifyVCache(adp, &treq);
+    code = afs_VerifyVCache(adp, treq);
     if (code) {
-       code = afs_CheckCode(code, &treq, 30);
+       code = afs_CheckCode(code, treq, 30);
        goto done;
     }
 
@@ -150,7 +150,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
        InStatus.UnixModeBits = 0755;
        alen++;                 /* add in the null */
     }
-    tdc = afs_GetDCache(adp, (afs_size_t) 0, &treq, &offset, &len, 1);
+    tdc = afs_GetDCache(adp, (afs_size_t) 0, treq, &offset, &len, 1);
     volp = afs_FindVolume(&adp->f.fid, READ_LOCK);     /*parent is also in same vol */
     ObtainWriteLock(&adp->lock, 156);
     if (tdc)
@@ -160,7 +160,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
      * the copy will be invalidated */
     if (!AFS_IS_DISCON_RW) {
        do {
-           tc = afs_Conn(&adp->f.fid, &treq, SHARED_LOCK, &rxconn);
+           tc = afs_Conn(&adp->f.fid, treq, SHARED_LOCK, &rxconn);
            if (tc) {
                hostp = tc->srvr->server;
                XSTATS_START_TIME(AFS_STATS_FS_RPCIDX_SYMLINK);
@@ -188,7 +188,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
            } else
                code = -1;
        } while (afs_Analyze
-                (tc, rxconn, code, &adp->f.fid, &treq, AFS_STATS_FS_RPCIDX_SYMLINK,
+                (tc, rxconn, code, &adp->f.fid, treq, AFS_STATS_FS_RPCIDX_SYMLINK,
                     SHARED_LOCK, NULL));
     } else {
        newFid.Cell = adp->f.fid.Cell;
@@ -264,8 +264,8 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
 
     if (AFS_IS_DISCON_RW) {
        attrs->va_mode = InStatus.UnixModeBits;
-       afs_GenDisconStatus(adp, tvc, &newFid, attrs, &treq, VLNK);
-       code = afs_DisconCreateSymlink(tvc, atargetName, &treq);
+       afs_GenDisconStatus(adp, tvc, &newFid, attrs, treq, VLNK);
+       code = afs_DisconCreateSymlink(tvc, atargetName, treq);
        if (code) {
            /* XXX - When this goes wrong, we need to tidy up the changes we made to
             * the parent, and get rid of the vcache we just created */
@@ -276,7 +276,7 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
        }
        afs_DisconAddDirty(tvc, VDisconCreate, 0);
     } else {
-       afs_ProcessFS(tvc, OutFidStatus, &treq);
+       afs_ProcessFS(tvc, OutFidStatus, treq);
     }
 
     if (!tvc->linkData) {
@@ -297,7 +297,8 @@ afs_symlink(OSI_VC_DECL(adp), char *aname, struct vattr *attrs,
     if (volp)
        afs_PutVolume(volp, READ_LOCK);
     AFS_DISCON_UNLOCK();
-    code = afs_CheckCode(code, &treq, 31);
+    code = afs_CheckCode(code, treq, 31);
+    afs_DestroyReq(treq);
   done2:
     osi_FreeSmallSpace(OutFidStatus);
     osi_FreeSmallSpace(OutDirStatus);
@@ -416,23 +417,23 @@ int
 afs_readlink(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred)
 {
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     char *tp;
     struct afs_fakestat_state fakestat;
     OSI_VC_CONVERT(avc);
 
     AFS_STATCNT(afs_readlink);
     afs_Trace1(afs_iclSetp, CM_TRACE_READLINK, ICL_TYPE_POINTER, avc);
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
     afs_InitFakeStat(&fakestat);
 
     AFS_DISCON_LOCK();
     
-    code = afs_EvalFakeStat(&avc, &fakestat, &treq);
+    code = afs_EvalFakeStat(&avc, &fakestat, treq);
     if (code)
        goto done;
-    code = afs_VerifyVCache(avc, &treq);
+    code = afs_VerifyVCache(avc, treq);
     if (code)
        goto done;
     if (vType(avc) != VLNK) {
@@ -440,7 +441,7 @@ afs_readlink(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred)
        goto done;
     }
     ObtainWriteLock(&avc->lock, 158);
-    code = afs_HandleLink(avc, &treq);
+    code = afs_HandleLink(avc, treq);
     /* finally uiomove it to user-land */
     if (code == 0) {
        tp = avc->linkData;
@@ -454,6 +455,7 @@ afs_readlink(OSI_VC_DECL(avc), struct uio *auio, afs_ucred_t *acred)
   done:
     afs_PutFakeStat(&fakestat);
     AFS_DISCON_UNLOCK();
-    code = afs_CheckCode(code, &treq, 32);
+    code = afs_CheckCode(code, treq, 32);
+    afs_DestroyReq(treq);
     return code;
 }
index 70429816ad6fd886094117f3280d46b62563b5ce..07b38ff45a9fc1186e16316805007439d8fa23fb 100644 (file)
@@ -121,14 +121,14 @@ afs_MemWrite(struct vcache *avc, struct uio *auio, int aio,
     struct iovec *tvec;                /* again, should have define */
 #endif
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
 
     AFS_STATCNT(afs_MemWrite);
     if (avc->vc_error)
        return avc->vc_error;
 
     startDate = osi_Time();
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
     /* otherwise we read */
     totalLength = AFS_UIO_RESID(auio);
@@ -182,6 +182,7 @@ afs_MemWrite(struct vcache *avc, struct uio *auio, int aio,
 #endif
        if (!noLock)
            ReleaseWriteLock(&avc->lock);
+       afs_DestroyReq(treq);
        return (EFBIG);
     }
 #endif
@@ -202,7 +203,7 @@ afs_MemWrite(struct vcache *avc, struct uio *auio, int aio,
     tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec));
 #endif
     while (totalLength > 0) {
-       tdc = afs_ObtainDCacheForWriting(avc, filePos, totalLength, &treq, 
+       tdc = afs_ObtainDCacheForWriting(avc, filePos, totalLength, treq,
                                         noLock);
        if (!tdc) {
            error = EIO;
@@ -265,7 +266,7 @@ afs_MemWrite(struct vcache *avc, struct uio *auio, int aio,
 #else
        if (filePos > avc->f.m.Length) {
            if (AFS_IS_DISCON_RW)
-               afs_PopulateDCache(avc, filePos, &treq);
+               afs_PopulateDCache(avc, filePos, treq);
            afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, ICL_TYPE_STRING,
                       __FILE__, ICL_TYPE_LONG, __LINE__, ICL_TYPE_OFFSET,
                       ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET,
@@ -284,7 +285,7 @@ afs_MemWrite(struct vcache *avc, struct uio *auio, int aio,
         * the high-level write op.
         */
        if (!noLock) {
-           code = afs_DoPartialWrite(avc, &treq);
+           code = afs_DoPartialWrite(avc, treq);
            if (code) {
                error = code;
                break;
@@ -304,7 +305,8 @@ afs_MemWrite(struct vcache *avc, struct uio *auio, int aio,
 #else
     osi_FreeSmallSpace(tvec);
 #endif
-    error = afs_CheckCode(error, &treq, 6);
+    error = afs_CheckCode(error, treq, 6);
+    afs_DestroyReq(treq);
     return error;
 }
 
@@ -339,7 +341,7 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
 #endif
     struct osi_file *tfile;
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
 
     AFS_STATCNT(afs_UFSWrite);
     if (avc->vc_error)
@@ -349,7 +351,7 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
        return ENETDOWN;
     
     startDate = osi_Time();
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
     /* otherwise we read */
     totalLength = AFS_UIO_RESID(auio);
@@ -403,6 +405,7 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
 #endif
        if (!noLock)
            ReleaseWriteLock(&avc->lock);
+       afs_DestroyReq(treq);
        return (EFBIG);
     }
 #endif
@@ -423,7 +426,7 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
     tvec = (struct iovec *)osi_AllocSmallSpace(sizeof(struct iovec));
 #endif
     while (totalLength > 0) {
-       tdc = afs_ObtainDCacheForWriting(avc, filePos, totalLength, &treq, 
+       tdc = afs_ObtainDCacheForWriting(avc, filePos, totalLength, treq,
                                         noLock);
        if (!tdc) {
            error = EIO;
@@ -573,7 +576,7 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
 #else
        if (filePos > avc->f.m.Length) {
            if (AFS_IS_DISCON_RW)
-               afs_PopulateDCache(avc, filePos, &treq);
+               afs_PopulateDCache(avc, filePos, treq);
            afs_Trace4(afs_iclSetp, CM_TRACE_SETLENGTH, ICL_TYPE_STRING,
                       __FILE__, ICL_TYPE_LONG, __LINE__, ICL_TYPE_OFFSET,
                       ICL_HANDLE_OFFSET(avc->f.m.Length), ICL_TYPE_OFFSET,
@@ -593,7 +596,7 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
         * the high-level write op.
         */
        if (!noLock) {
-           code = afs_DoPartialWrite(avc, &treq);
+           code = afs_DoPartialWrite(avc, treq);
            if (code) {
                error = code;
                break;
@@ -604,7 +607,7 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
 #if !defined(AFS_VM_RDWR_ENV) || defined(AFS_FAKEOPEN_ENV)
     afs_FakeClose(avc, acred);
 #endif
-    error = afs_CheckCode(error, &treq, 7);
+    error = afs_CheckCode(error, treq, 7);
     /* This set is here so we get the CheckCode. */
     if (error && !avc->vc_error)
        avc->vc_error = error;
@@ -637,6 +640,7 @@ afs_UFSWrite(struct vcache *avc, struct uio *auio, int aio,
            afs_fsync(avc, acred);
     }
 #endif
+    afs_DestroyReq(treq);
     return error;
 }
 
@@ -683,7 +687,7 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
     afs_int32 code;
     afs_int32 code_checkcode = 0;
     struct brequest *tb;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
 #ifdef AFS_SGI65_ENV
     struct flid flid;
 #endif
@@ -693,25 +697,27 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
     AFS_STATCNT(afs_close);
     afs_Trace2(afs_iclSetp, CM_TRACE_CLOSE, ICL_TYPE_POINTER, avc,
               ICL_TYPE_INT32, aflags);
-    code = afs_InitReq(&treq, acred);
+    code = afs_CreateReq(&treq, acred);
     if (code)
        return code;
     afs_InitFakeStat(&fakestat);
-    code = afs_EvalFakeStat(&avc, &fakestat, &treq);
+    code = afs_EvalFakeStat(&avc, &fakestat, treq);
     if (code) {
        afs_PutFakeStat(&fakestat);
+       afs_DestroyReq(treq);
        return code;
     }
     AFS_DISCON_LOCK();
 #ifdef AFS_SUN5_ENV
     if (avc->flockCount) {
-       HandleFlock(avc, LOCK_UN, &treq, 0, 1 /*onlymine */ );
+       HandleFlock(avc, LOCK_UN, treq, 0, 1 /*onlymine */ );
     }
 #endif
 #if defined(AFS_SGI_ENV)
     if (!lastclose) {
        afs_PutFakeStat(&fakestat);
         AFS_DISCON_UNLOCK();
+       afs_DestroyReq(treq);
        return 0;
     }
     /* unlock any locks for pid - could be wrong for child .. */
@@ -719,14 +725,14 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
 # ifdef AFS_SGI65_ENV
     get_current_flid(&flid);
     cleanlocks((vnode_t *) avc, flid.fl_pid, flid.fl_sysid);
-    HandleFlock(avc, LOCK_UN, &treq, flid.fl_pid, 1 /*onlymine */ );
+    HandleFlock(avc, LOCK_UN, treq, flid.fl_pid, 1 /*onlymine */ );
 # else
 #  ifdef AFS_SGI64_ENV
     cleanlocks((vnode_t *) avc, flp);
 #  else /* AFS_SGI64_ENV */
     cleanlocks((vnode_t *) avc, u.u_procp->p_epid, u.u_procp->p_sysid);
 #  endif /* AFS_SGI64_ENV */
-    HandleFlock(avc, LOCK_UN, &treq, OSI_GET_CURRENT_PID(), 1 /*onlymine */ );
+    HandleFlock(avc, LOCK_UN, treq, OSI_GET_CURRENT_PID(), 1 /*onlymine */ );
 # endif /* AFS_SGI65_ENV */
     /* afs_chkpgoob will drop and re-acquire the global lock. */
     afs_chkpgoob(&avc->v, btoc(avc->f.m.Length));
@@ -737,18 +743,19 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
         * with the close. */
        afs_PutFakeStat(&fakestat);
        AFS_DISCON_UNLOCK();
+       afs_DestroyReq(treq);
        return 0;
     }
 #else
     if (avc->flockCount) {     /* Release Lock */
-       HandleFlock(avc, LOCK_UN, &treq, 0, 1 /*onlymine */ );
+       HandleFlock(avc, LOCK_UN, treq, 0, 1 /*onlymine */ );
     }
 #endif
     if (aflags & (FWRITE | FTRUNC)) {
        if (afs_BBusy() || (AFS_NFSXLATORREQ(acred)) || AFS_IS_DISCONNECTED) {
            /* do it yourself if daemons are all busy */
            ObtainWriteLock(&avc->lock, 124);
-           code = afs_StoreOnLastReference(avc, &treq);
+           code = afs_StoreOnLastReference(avc, treq);
            ReleaseWriteLock(&avc->lock);
 #if defined(AFS_SGI_ENV)
            AFS_RWUNLOCK((vnode_t *) avc, VRWLOCK_WRITE);
@@ -860,8 +867,9 @@ afs_close(OSI_VC_DECL(avc), afs_int32 aflags, afs_ucred_t *acred)
     if (code_checkcode) {
        code = code_checkcode;
     } else {
-       code = afs_CheckCode(code, &treq, 5);
+       code = afs_CheckCode(code, treq, 5);
     }
+    afs_DestroyReq(treq);
     return code;
 }
 
@@ -878,7 +886,7 @@ afs_fsync(OSI_VC_DECL(avc), afs_ucred_t *acred)
 #endif 
 {
     afs_int32 code;
-    struct vrequest treq;
+    struct vrequest *treq = NULL;
     OSI_VC_CONVERT(avc);
 
     if (avc->vc_error)
@@ -892,7 +900,7 @@ afs_fsync(OSI_VC_DECL(avc), afs_ucred_t *acred)
 
     AFS_STATCNT(afs_fsync);
     afs_Trace1(afs_iclSetp, CM_TRACE_FSYNC, ICL_TYPE_POINTER, avc);
-    if ((code = afs_InitReq(&treq, acred)))
+    if ((code = afs_CreateReq(&treq, acred)))
        return code;
     AFS_DISCON_LOCK();
 #if defined(AFS_SGI_ENV)
@@ -909,7 +917,7 @@ afs_fsync(OSI_VC_DECL(avc), afs_ucred_t *acred)
            
            /* put the file back */
            UpgradeSToWLock(&avc->lock, 41);
-           code = afs_StoreAllSegments(avc, &treq, AFS_SYNC);
+           code = afs_StoreAllSegments(avc, treq, AFS_SYNC);
            ConvertWToSLock(&avc->lock);
        } else {
            UpgradeSToWLock(&avc->lock, 711);
@@ -928,7 +936,8 @@ afs_fsync(OSI_VC_DECL(avc), afs_ucred_t *acred)
     }
 #endif
     AFS_DISCON_UNLOCK();
-    code = afs_CheckCode(code, &treq, 33);
+    code = afs_CheckCode(code, treq, 33);
+    afs_DestroyReq(treq);
     ReleaseSharedLock(&avc->lock);
     return code;
 }