}
-static
+static afs_int32
MyBeforeProc(struct rx_call *acall)
{
VTRANS_LOCK;
return 0;
}
-static
+static afs_int32
MyAfterProc(struct rx_call *acall, afs_int32 code)
{
VTRANS_LOCK;
/* Called every GCWAKEUP seconds to try to unlock all our partitions,
* if we're idle and there are no active transactions
*/
-static
+static void
TryUnlock()
{
/* if there are no running calls, and there are no active transactions, then
}
/* background daemon for timing out transactions */
-static
+static void
BKGLoop()
{
struct timeval tv;
/* Background daemon for sleeping so the volserver does not become I/O bound */
afs_int32 TTsleep, TTrun;
-static
+static void
BKGSleep()
{
struct volser_trans *tt;
#ifndef AFS_NT40_ENV
int
-volser_syscall(a3, a4, a5)
- afs_uint32 a3, a4;
- void *a5;
+volser_syscall(afs_uint32 a3, afs_uint32 a4, void *a5)
{
afs_uint32 rcode;
void (*old) ();
/* check whether caller is authorized to manage RX statistics */
int
-vol_rxstat_userok(call)
- struct rx_call *call;
+vol_rxstat_userok(struct rx_call *call)
{
return afsconf_SuperUser(tdir, call, NULL);
}
#include "AFS_component_version_number.c"
-main(argc, argv)
- int argc;
- char **argv;
+int
+main(int argc, char **argv)
{
register afs_int32 code;
struct rx_securityClass *(securityObjects[3]);
if (error) {
Log("1 Volser: CreateVolume: Unable to create the volume; aborted, error code %u\n", error);
LogError(error);
- DeleteTrans(tt);
+ DeleteTrans(tt, 1);
return EIO;
}
V_uniquifier(vp) = 1;
if (error) {
Log("1 Volser: create UpdateVolume failed, code %d\n", error);
LogError(error);
- DeleteTrans(tt);
+ DeleteTrans(tt, 1);
VDetachVolume(&junk, vp); /* rather return the real error code */
return error;
}
error = VOLSERTRELE_ERROR;
goto fail;
}
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
return 0;
fail:
TRELE(tt);
}
if (ttc)
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
return error;
}
goto fail;
}
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
{
struct DiskPartition *tpartp = originalvp->partition;
TRELE(tt);
}
if (ttc)
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
return error;
}
/* give up */
if (tv)
VDetachVolume(&code, tv);
- DeleteTrans(tt);
+ DeleteTrans(tt, 1);
return error;
}
tt->volume = tv;
return ENOENT;
}
*rcode = tt->returnCode;
- DeleteTrans(tt); /* this does an implicit TRELE */
+ DeleteTrans(tt, 1); /* this does an implicit TRELE */
return 0;
}
tv = (Volume *) 0;
}
if (ttc) {
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
ttc = (struct volser_trans *)0;
}
tv = (Volume *) 0;
}
if (ttc) {
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
ttc = (struct volser_trans *)0;
}
drop:
if (ttc) {
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
ttc = (struct volser_trans *)0;
}
pntr++;
tv = (Volume *) 0;
}
if (ttc) {
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
ttc = (struct volser_trans *)0;
}
closedir(dirp);
tv = (Volume *) 0;
}
if (ttc) {
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
ttc = (struct volser_trans *)0;
}
GetNextVol(dirp, volname, &volid);
}
closedir(dirp);
if (ttc)
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
return 0;
}
* Drop the transaction we have for this volume.
*/
if (ttc) {
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
ttc = (struct volser_trans *)0;
}
tv = (Volume *) 0;
}
if (ttc) {
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
ttc = (struct volser_trans *)0;
}
closedir(dirp);
tv = (Volume *) 0;
}
if (ttc) {
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
ttc = (struct volser_trans *)0;
}
GetNextVol(dirp, volname, &volid);
*/
closedir(dirp);
if (ttc)
- DeleteTrans(ttc);
+ DeleteTrans(ttc, 1);
return (0);
} /*SAFSVolXListVolumes */
/* create a new transaction, returning ptr to same with high ref count */
struct volser_trans *
-NewTrans(avol, apart)
- afs_int32 avol;
- afs_int32 apart;
+NewTrans(afs_int32 avol, afs_int32 apart)
{
/* set volid, next, partition */
register struct volser_trans *tt;
/* find a trans, again returning with high ref count */
struct volser_trans *
-FindTrans(atrans)
- register afs_int32 atrans;
+FindTrans(register afs_int32 atrans)
{
register struct volser_trans *tt;
VTRANS_LOCK;
}
/* delete transaction if refcount == 1, otherwise queue delete for later. Does implicit TRELE */
-DeleteTrans(atrans)
- register struct volser_trans *atrans;
+afs_int32
+DeleteTrans(register struct volser_trans *atrans, afs_int32 lock)
{
register struct volser_trans *tt, **lt;
afs_int32 error;
}
/* otherwise we zap it ourselves */
- VTRANS_LOCK;
+ if (lock) VTRANS_LOCK;
lt = &allTrans;
for (tt = *lt; tt; lt = &tt->next, tt = *lt) {
if (tt == atrans) {
tt->volume = NULL;
*lt = tt->next;
free(tt);
- VTRANS_UNLOCK;
+ if (lock) VTRANS_UNLOCK;
return 0;
}
}
- VTRANS_UNLOCK;
+ if (lock) VTRANS_UNLOCK;
return -1; /* failed to find the transaction in the generic list */
}
/* THOLD is a macro defined in volser.h */
/* put a transaction back */
-TRELE(at)
- register struct volser_trans *at;
+afs_int32
+TRELE(register struct volser_trans *at)
{
if (at->refCount == 0) {
Log("TRELE: bad refcount\n");
at->time = FT_ApproxTime(); /* we're still using it */
if (at->refCount == 1 && (at->tflags & TTDeleted)) {
- DeleteTrans(at);
+ DeleteTrans(at, 1);
return 0;
}
/* otherwise simply drop refcount */
#define OLDTRANSTIME 600 /* seconds */
#define OLDTRANSWARN 300 /* seconds */
static int GCDeletes = 0;
+afs_int32
GCTrans()
{
register struct volser_trans *tt, *nt;
if (tt->time + OLDTRANSTIME < now) {
Log("trans %u on volume %u has timed out\n", tt->tid, tt->volid);
tt->refCount++; /* we're using it now */
- DeleteTrans(tt); /* drops refCount or deletes it */
+ DeleteTrans(tt, 0); /* drops refCount or deletes it */
GCDeletes++;
}
}