volser: Delete timed-out temporary volumes
authorAndrew Deason <adeason@sinenomine.net>
Tue, 14 Sep 2010 16:15:22 +0000 (12:15 -0400)
committerDerrick Brashear <shadow@dementia.org>
Mon, 20 Sep 2010 05:33:47 +0000 (22:33 -0700)
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 <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/volser/voltrans.c

index eb0c2a5..b350fa3 100644 (file)
@@ -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++;
        }