From bc56f5cc97a982ee29219e6f258b372dbfe1a020 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Tue, 14 Sep 2010 12:15:22 -0400 Subject: [PATCH] volser: Delete timed-out temporary volumes When a transaction times out on a volume, delete the volume if it is a temporary volume (destroyMe is set). This prevents half-created volumes from accumulating, which can take up space and screw up certain vol ops in some versions. Change-Id: I94e9adc767b84a2a32d980f508af33b823560950 Reviewed-on: http://gerrit.openafs.org/2760 Tested-by: Andrew Deason Tested-by: BuildBot Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear --- src/volser/voltrans.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/volser/voltrans.c b/src/volser/voltrans.c index eb0c2a5..b350fa3 100644 --- a/src/volser/voltrans.c +++ b/src/volser/voltrans.c @@ -208,7 +208,26 @@ GCTrans(void) continue; 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 */ + + if (tt->volume && V_destroyMe(tt->volume) == DESTROY_ME + && !(tt->vflags & VTDeleted)) { + + Error error; + + Log("Deleting timed-out temporary volume %lu\n", + (long unsigned) tt->volid); + + VTRANS_OBJ_LOCK(tt); + tt->vflags |= VTDeleted; + VTRANS_OBJ_UNLOCK(tt); + + VTRANS_UNLOCK; + VPurgeVolume(&error, tt->volume); + VTRANS_LOCK; + } + DeleteTrans(tt, 0); /* drops refCount or deletes it */ GCDeletes++; } -- 1.9.4