]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
volser transaction object race conditions
authorMichael Meffie <mmeffie@sinenomine.net>
Wed, 18 Nov 2009 15:07:14 +0000 (10:07 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 19 Nov 2009 18:58:34 +0000 (10:58 -0800)
Fix the transaction object races between VolMonitor and the
volume operation procedures which can cause the volume
server to crash.

Add a per transaction object mutex to safely set the
transaction call pointer and name. Fix VolMonitor to safely
traverse the transaction list and to access the call pointer
and last proc name while copying info to send to the vos
client.  Fix the sleep thread to safely access the last proc
name.

FIXES 125479

Change-Id: I6dffa31a84d98249712dd17aad353f99151b4fd5
Reviewed-on: http://gerrit.openafs.org/619
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Tom Keiser <tkeiser@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/volser/Makefile.in
src/volser/volmain.c
src/volser/volprocs.c
src/volser/volser.p.h
src/volser/voltrans.c
src/volser/voltrans_inline.h [new file with mode: 0644]

index 7952b410e295849afe68b1e4f55300b55cd40f3d..dd4e7aefa391a62e2529586821fb7ffa55b8a39c 100644 (file)
@@ -11,7 +11,8 @@ HELPER_SPLINT=@HELPER_SPLINT@
 
 
 VINCLS=${TOP_INCDIR}/afs/partition.h ${TOP_INCDIR}/afs/volume.h \
-       ${TOP_INCDIR}/afs/vlserver.h vol.h dump.h volser.h  lockdata.h
+       ${TOP_INCDIR}/afs/vlserver.h vol.h dump.h volser.h  lockdata.h \
+       voltrans_inline.h
 
 RINCLS=${TOP_INCDIR}/rx/rx.h ${TOP_INCDIR}/rx/xdr.h \
        ${TOP_INCDIR}/afs/keys.h ${TOP_INCDIR}/afs/cellconfig.h \
index be51c7942742535cba321f0793ffc29f53ba3a5f..3a7e19487978d28789708280adc0d1da0fe41f3d 100644 (file)
@@ -184,13 +184,17 @@ BKGSleep(void *unused)
 #endif
            VTRANS_LOCK;
            for (tt = TransList(); tt; tt = tt->next) {
+                VTRANS_OBJ_LOCK(tt);
                if ((strcmp(tt->lastProcName, "DeleteVolume") == 0)
                    || (strcmp(tt->lastProcName, "Clone") == 0)
                    || (strcmp(tt->lastProcName, "ReClone") == 0)
                    || (strcmp(tt->lastProcName, "Forward") == 0)
                    || (strcmp(tt->lastProcName, "Restore") == 0)
-                   || (strcmp(tt->lastProcName, "ForwardMulti") == 0))
+                   || (strcmp(tt->lastProcName, "ForwardMulti") == 0)) {
+                    VTRANS_OBJ_UNLOCK(tt);
                    break;
+                }
+                VTRANS_OBJ_UNLOCK(tt);
            }
            if (tt) {
                VTRANS_UNLOCK;
index 93b7b8a7a35ffc5a467b8dca75c65430b1674ba4..48cd7a0c332a6d11a2c24eb4a0eab608f9be4da6 100644 (file)
@@ -58,6 +58,7 @@
 #include <afs/dir.h>
 
 #include "volser.h"
+#include "voltrans_inline.h"
 #include "volint.h"
 
 #include "volser_prototypes.h"
@@ -467,12 +468,13 @@ VolCreateVolume(struct rx_call *acid, afs_int32 apart, char *aname,
        VDetachVolume(&junk, vp);       /* rather return the real error code */
        return error;
     }
+    VTRANS_OBJ_LOCK(tt);
     tt->volume = vp;
     *atrans = tt->tid;
-    strcpy(tt->lastProcName, "CreateVolume");
-    tt->rxCallPtr = acid;
+    TSetRxCall_r(tt, acid, "CreateVolume");
+    VTRANS_OBJ_UNLOCK(tt);
     Log("1 Volser: CreateVolume: volume %u (%s) created\n", volumeID, aname);
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
     return 0;
@@ -508,11 +510,12 @@ VolDeleteVolume(struct rx_call *acid, afs_int32 atrans)
     }
     if (DoLogging)
        Log("%s is executing Delete Volume %u\n", caller, tt->volid);
-    strcpy(tt->lastProcName, "DeleteVolume");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "DeleteVolume");
     VPurgeVolume(&error, tt->volume);  /* don't check error code, it is not set! */
+    VTRANS_OBJ_LOCK(tt);
     tt->vflags |= VTDeleted;   /* so we know not to do anything else to it */
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall_r(tt);
+    VTRANS_OBJ_UNLOCK(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
 
@@ -586,8 +589,7 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_int32 purgeId,
        TRELE(tt);
        return VBUSY;
     }
-    strcpy(tt->lastProcName, "Clone");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "Clone");
 
 
     if (purgeId) {
@@ -692,7 +694,7 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_int32 purgeId,
        LogError(error);
        goto fail;
     }
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt)) {
        tt = (struct volser_trans *)0;
        error = VOLSERTRELE_ERROR;
@@ -707,7 +709,7 @@ VolClone(struct rx_call *acid, afs_int32 atrans, afs_int32 purgeId,
     if (newvp)
        VDetachVolume(&code, newvp);
     if (tt) {
-       tt->rxCallPtr = (struct rx_call *)0;
+       TClearRxCall(tt);
        TRELE(tt);
     }
     if (ttc)
@@ -758,8 +760,7 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId)
        TRELE(tt);
        return VBUSY;
     }
-    strcpy(tt->lastProcName, "ReClone");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "ReClone");
 
     originalvp = tt->volume;
     if ((V_type(originalvp) == backupVolume)
@@ -859,7 +860,7 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId)
        LogError(error);
        goto fail;
     }
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt)) {
        tt = (struct volser_trans *)0;
        error = VOLSERTRELE_ERROR;
@@ -878,7 +879,7 @@ VolReClone(struct rx_call *acid, afs_int32 atrans, afs_int32 cloneId)
     if (clonevp)
        VDetachVolume(&code, clonevp);
     if (tt) {
-       tt->rxCallPtr = (struct rx_call *)0;
+       TClearRxCall(tt);
        TRELE(tt);
     }
     if (ttc)
@@ -942,11 +943,13 @@ VolTransCreate(struct rx_call *acid, afs_int32 volume, afs_int32 partition,
        DeleteTrans(tt, 1);
        return error;
     }
+    VTRANS_OBJ_LOCK(tt);
     tt->volume = tv;
     *ttid = tt->tid;
     tt->iflags = iflags;
     tt->vflags = 0;
-    strcpy(tt->lastProcName, "TransCreate");
+    TSetRxCall_r(tt, NULL, "TransCreate");
+    VTRANS_OBJ_UNLOCK(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
 
@@ -1002,10 +1005,9 @@ VolGetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 *aflags)
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "GetFlags");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "GetFlags");
     *aflags = tt->vflags;
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
 
@@ -1047,8 +1049,7 @@ VolSetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 aflags)
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "SetFlags");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "SetFlags");
     vp = tt->volume;           /* pull volume out of transaction */
 
     /* check if we're allowed to make any updates */
@@ -1070,8 +1071,10 @@ VolSetFlags(struct rx_call *acid, afs_int32 atid, afs_int32 aflags)
        V_inService(vp) = 1;
     }
     VUpdateVolume(&error, vp);
+    VTRANS_OBJ_LOCK(tt);
     tt->vflags = aflags;
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall_r(tt);
+    VTRANS_OBJ_UNLOCK(tt);
     if (TRELE(tt) && !error)
        return VOLSERTRELE_ERROR;
 
@@ -1126,7 +1129,7 @@ VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
        return ENOENT;
     }
     vp = tt->volume;
-    strcpy(tt->lastProcName, "Forward");
+    TSetRxCall(tt, NULL, "Forward");
 
     /* get auth info for the this connection (uses afs from ticket file) */
     code = afsconf_ClientAuth(tdir, &securityObject, &securityIndex);
@@ -1141,12 +1144,12 @@ VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
                         htons(destination->destPort), VOLSERVICE_ID,
                         securityObject, securityIndex);
     if (!tcon) {
-       tt->rxCallPtr = (struct rx_call *)0;
+        TClearRxCall(tt);
        TRELE(tt);
        return ENOTCONN;
     }
     tcall = rx_NewCall(tcon);
-    tt->rxCallPtr = tcall;
+    TSetRxCall(tt, tcall, "Forward");
     /* start restore going.  fromdate == 0 --> doing an incremental dump/restore */
     code = StartAFSVolRestore(tcall, destTrans, (fromDate ? 1 : 0), cookie);
     if (code) {
@@ -1158,7 +1161,7 @@ VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
     if (code)
        goto fail;
     EndAFSVolRestore(tcall);   /* probably doesn't do much */
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     code = rx_EndCall(tcall, 0);
     rx_DestroyConnection(tcon);        /* done with the connection */
     tcon = NULL;
@@ -1175,7 +1178,7 @@ VolForward(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
        rx_DestroyConnection(tcon);
     }
     if (tt) {
-       tt->rxCallPtr = (struct rx_call *)0;
+       TClearRxCall(tt);
        TRELE(tt);
     }
     return code;
@@ -1226,7 +1229,7 @@ SAFSVolForwardMultiple(struct rx_call *acid, afs_int32 fromTrans, afs_int32
        return ENOENT;
     }
     vp = tt->volume;
-    strcpy(tt->lastProcName, "ForwardMulti");
+    TSetRxCall(tt, NULL, "ForwardMulti");
 
     /* (fromDate == 0) ==> full dump */
     is_incremental = (fromDate ? 1 : 0);
@@ -1302,7 +1305,7 @@ SAFSVolForwardMultiple(struct rx_call *acid, afs_int32 fromTrans, afs_int32
     free(tcalls);
 
     if (tt) {
-       tt->rxCallPtr = (struct rx_call *)0;
+       TClearRxCall(tt);
        if (TRELE(tt) && !code) /* return the first code if it's set */
            return VOLSERTRELE_ERROR;
     }
@@ -1347,16 +1350,15 @@ VolDump(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate, afs_int32
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "Dump");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "Dump");
     code = DumpVolume(acid, tt->volume, fromDate, (flags & VOLDUMPV2_OMITDIRS)
                      ? 0 : 1); /* squirt out the volume's data, too */
     if (code) {
-       tt->rxCallPtr = (struct rx_call *)0;
+       TClearRxCall(tt);
        TRELE(tt);
        return code;
     }
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
 
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
@@ -1396,15 +1398,14 @@ VolRestore(struct rx_call *acid, afs_int32 atrans, afs_int32 aflags,
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "Restore");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "Restore");
 
     DFlushVolume(V_parentId(tt->volume)); /* Ensure dir buffers get dropped */
 
     code = RestoreVolume(acid, tt->volume, (aflags & 1), cookie);      /* last is incrementalp */
     FSYNC_askfs(tt->volid, NULL, FSYNC_RESTOREVOLUME, 0l);     /*break call backs on the
                                                                 * restored volume */
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     tcode = TRELE(tt);
 
     return (code ? code : tcode);
@@ -1467,10 +1468,9 @@ VolSetForwarding(struct rx_call *acid, afs_int32 atid, afs_int32 anewsite)
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "SetForwarding");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "SetForwarding");
     FSYNC_askfs(tt->volid, NULL, FSYNC_MOVEVOLUME, anewsite);
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
 
@@ -1506,11 +1506,10 @@ VolGetStatus(struct rx_call *acid, afs_int32 atrans,
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "GetStatus");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "GetStatus");
     tv = tt->volume;
     if (!tv) {
-       tt->rxCallPtr = (struct rx_call *)0;
+        TClearRxCall(tt);
        TRELE(tt);
        return ENOENT;
     }
@@ -1532,7 +1531,7 @@ VolGetStatus(struct rx_call *acid, afs_int32 atrans,
     astatus->expirationDate = td->expirationDate;
     astatus->backupDate = td->backupDate;
     astatus->copyDate = td->copyDate;
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
 
@@ -1570,11 +1569,10 @@ VolSetInfo(struct rx_call *acid, afs_int32 atrans,
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "SetStatus");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "SetStatus");
     tv = tt->volume;
     if (!tv) {
-       tt->rxCallPtr = (struct rx_call *)0;
+       TClearRxCall(tt);
        TRELE(tt);
        return ENOENT;
     }
@@ -1592,7 +1590,7 @@ VolSetInfo(struct rx_call *acid, afs_int32 atrans,
     if (astatus->updateDate != -1)
        td->updateDate = astatus->updateDate;
     VUpdateVolume(&error, tv);
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
     return 0;
@@ -1629,11 +1627,10 @@ VolGetName(struct rx_call *acid, afs_int32 atrans, char **aname)
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "GetName");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "GetName");
     tv = tt->volume;
     if (!tv) {
-       tt->rxCallPtr = (struct rx_call *)0;
+       TClearRxCall(tt);
        TRELE(tt);
        return ENOENT;
     }
@@ -1641,13 +1638,13 @@ VolGetName(struct rx_call *acid, afs_int32 atrans, char **aname)
     td = &tv->header->diskstuff;
     len = strlen(td->name) + 1;        /* don't forget the null */
     if (len >= SIZE) {
-       tt->rxCallPtr = (struct rx_call *)0;
+       TClearRxCall(tt);
        TRELE(tt);
        return E2BIG;
     }
     *aname = (char *)realloc(*aname, len);
     strcpy(*aname, td->name);
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
 
@@ -2653,10 +2650,15 @@ VolMonitor(struct rx_call *acid, transDebugEntries *transInfo)
        return ENOMEM;
     pntr = transInfo->transDebugEntries_val;
     transInfo->transDebugEntries_len = 0;
+
+    VTRANS_LOCK;
     allTrans = TransList();
     if (allTrans == (struct volser_trans *)0)
-       return 0;               /*no active transactions */
+       goto done;              /*no active transactions */
     for (tt = allTrans; tt; tt = tt->next) {   /*copy relevant info into pntr */
+        THOLD(tt);  /* do not delete tt while copying info */
+        VTRANS_UNLOCK;
+        VTRANS_OBJ_LOCK(tt);
        pntr->tid = tt->tid;
        pntr->time = tt->time;
        pntr->creationTime = tt->creationTime;
@@ -2675,6 +2677,7 @@ VolMonitor(struct rx_call *acid, transDebugEntries *transInfo)
            pntr->lastSendTime = tt->rxCallPtr->lastSendTime;
            pntr->lastReceiveTime = tt->rxCallPtr->lastReceiveTime;
        }
+        VTRANS_OBJ_UNLOCK(tt);
        pntr++;
        transInfo->transDebugEntries_len += 1;
        if ((allocSize - transInfo->transDebugEntries_len) < 5) {       /*alloc some more space */
@@ -2691,7 +2694,11 @@ VolMonitor(struct rx_call *acid, transDebugEntries *transInfo)
            /*set pntr to right position */
        }
 
+        TRELE(tt);
+        VTRANS_LOCK;
     }
+done:
+    VTRANS_UNLOCK;
 
     return 0;
 }
@@ -2729,8 +2736,7 @@ VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 type
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "SetIdsTypes");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "SetIdsTypes");
     tv = tt->volume;
 
     V_type(tv) = type;
@@ -2744,13 +2750,13 @@ VolSetIdsTypes(struct rx_call *acid, afs_int32 atid, char name[], afs_int32 type
        LogError(error);
        goto fail;
     }
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt) && !error)
        return VOLSERTRELE_ERROR;
 
     return error;
   fail:
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt) && !error)
        return VOLSERTRELE_ERROR;
     return error;
@@ -2786,8 +2792,7 @@ VolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate)
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "SetDate");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "SetDate");
     tv = tt->volume;
 
     V_creationDate(tv) = cdate;
@@ -2797,13 +2802,13 @@ VolSetDate(struct rx_call *acid, afs_int32 atid, afs_int32 cdate)
        LogError(error);
        goto fail;
     }
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt) && !error)
        return VOLSERTRELE_ERROR;
 
     return error;
   fail:
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt) && !error)
        return VOLSERTRELE_ERROR;
     return error;
@@ -2887,10 +2892,9 @@ SAFSVolGetSize(struct rx_call *acid, afs_int32 fromTrans, afs_int32 fromDate,
        TRELE(tt);
        return ENOENT;
     }
-    strcpy(tt->lastProcName, "GetSize");
-    tt->rxCallPtr = acid;
+    TSetRxCall(tt, acid, "GetSize");
     code = SizeDumpVolume(acid, tt->volume, fromDate, 1, size);        /* measure volume's data */
-    tt->rxCallPtr = (struct rx_call *)0;
+    TClearRxCall(tt);
     if (TRELE(tt))
        return VOLSERTRELE_ERROR;
 
index 95c59654cc416567461925968b609d497ce3f102..58f868d5eae9c14f1723232380d6d3b7d42c3680 100644 (file)
@@ -56,6 +56,9 @@ struct volser_trans {
     /* the fields below are useful for debugging */
     char lastProcName[30];     /* name of the last procedure which used transaction */
     struct rx_call *rxCallPtr; /* pointer to latest associated rx_call */
+#ifdef AFS_PTHREAD_ENV
+    pthread_mutex_t lock;       /* per transaction lock */
+#endif
 
 };
 
@@ -70,6 +73,22 @@ struct volser_dest {
     afs_int32 destSSID;
 };
 
+#ifdef AFS_PTHREAD_ENV
+#define VTRANS_OBJ_LOCK_INIT(tt) \
+  assert(pthread_mutex_init(&((tt)->lock),NULL) == 0)
+#define VTRANS_OBJ_LOCK_DESTROY(tt) \
+  assert(pthread_mutex_destroy(&((tt)->lock)) == 0)
+#define VTRANS_OBJ_LOCK(tt) \
+  assert(pthread_mutex_lock(&((tt)->lock)) == 0)
+#define VTRANS_OBJ_UNLOCK(tt) \
+  assert(pthread_mutex_unlock(&((tt)->lock)) == 0)
+#else
+#define VTRANS_OBJ_LOCK_INIT(tt)
+#define VTRANS_OBJ_LOCK_DESTROY(tt)
+#define VTRANS_OBJ_LOCK(tt)
+#define VTRANS_OBJ_UNLOCK(tt)
+#endif /* AFS_PTHREAD_ENV */
+
 #define        MAXHELPERS          10
 /* flags for vol helper busyFlags array.  First, VHIdle goes on when a server
  * becomes idle.  Next, idle flag is cleared and VHRequest goes on when
index a3ff40feff3f04a5a5496c9a22d810d0ed629fb9..df096f2aab71497aba0f0f92ac46fcb34aa4bbf3 100644 (file)
@@ -99,6 +99,7 @@ NewTrans(afs_int32 avol, afs_int32 apart)
     tt->time = FT_ApproxTime();
     tt->tid = transCounter++;
     tt->next = allTrans;
+    VTRANS_OBJ_LOCK_INIT(tt);
     allTrans = tt;
     VTRANS_UNLOCK;
     return tt;
@@ -148,6 +149,7 @@ DeleteTrans(register struct volser_trans *atrans, afs_int32 lock)
            if (tt->rxCallPtr)
                rxi_CallError(tt->rxCallPtr, RX_CALL_DEAD);
            *lt = tt->next;
+           VTRANS_OBJ_LOCK_DESTROY(tt);
            free(tt);
            if (lock) VTRANS_UNLOCK;
            return 0;
diff --git a/src/volser/voltrans_inline.h b/src/volser/voltrans_inline.h
new file mode 100644 (file)
index 0000000..b3736f7
--- /dev/null
@@ -0,0 +1,83 @@
+/*
+ * Copyright 2000, International Business Machines Corporation and others.
+ * Copyright 2009, Sine Nomine Associates
+ * All Rights Reserved.
+ *
+ * This software has been released under the terms of the IBM Public
+ * License.  For details, see the LICENSE file in the top-level source
+ * directory or online at http://www.openafs.org/dl/license10.html
+ */
+
+#ifndef _VOLTRANS_INLINE_H
+#define _VOLTRANS_INLINE_H
+
+#include "volser.h"
+
+/**
+ * Save the most recent call and procedure name for
+ * transaction status reporting.
+ *
+ * \param tt    transaction object
+ * \param call  the rx call object, NULL if none
+ * \param name  procedure name, NULL if none
+ *
+ * \pre VTRANS_OBJ_LOCK on tt must be held
+ */
+static_inline void
+TSetRxCall_r(struct volser_trans *tt, struct rx_call *call, const char *name)
+{
+    if (name) {
+        strlcpy(tt->lastProcName, name, sizeof(tt->lastProcName));
+    }
+    if (call) {
+        tt->rxCallPtr = call;
+    }
+}
+
+/**
+ * Clears the most recent call object.
+ *
+ * \param tt    transaction object
+ *
+ * \pre VTRANS_OBJ_LOCK on tt must be held
+ */
+static_inline void
+TClearRxCall_r(struct volser_trans *tt)
+{
+    tt->rxCallPtr = NULL;
+}
+
+/**
+ * Save the most recent call and procedure name for
+ * transaction status reporting.
+ *
+ * \param tt    transaction object
+ * \param call  the rx call object, NULL if none
+ * \param name  procedure name, NULL if none
+ *
+ * \pre VTRANS_OBJ_LOCK on tt must not be held
+ */
+static_inline void
+TSetRxCall(struct volser_trans *tt, struct rx_call *call, const char *name)
+{
+    VTRANS_OBJ_LOCK(tt);
+    TSetRxCall_r(tt, call, name);
+    VTRANS_OBJ_UNLOCK(tt);
+}
+
+/**
+ * Clears the most recent call object.
+ *
+ * \param tt    transaction object
+ *
+ * \pre VTRANS_OBJ_LOCK on tt must not be held
+ */
+static_inline void
+TClearRxCall(struct volser_trans *tt)
+{
+    VTRANS_OBJ_LOCK(tt);
+    TClearRxCall_r(tt);
+    VTRANS_OBJ_UNLOCK(tt);
+}
+
+#endif /* _VOLTRANS_INLINE_H */