]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
vol: Initialise list before error exit when cloning
authorSimon Wilkinson <sxw@inf.ed.ac.uk>
Wed, 13 Jul 2011 13:35:48 +0000 (14:35 +0100)
committerDerrick Brashear <shadow@dementia.org>
Wed, 13 Jul 2011 22:52:30 +0000 (15:52 -0700)
The inode list wasn't being initialised before the first call into the
error handler. This makes it possible that we end up trying to discard
items from an uninitialised list, with all the chaos that would cause.
Fix things so that this list is correctly set up.

Change-Id: I5dbc33e2e1a9a4ca1bdf4b2f7e56f33af87ccc1a
Reviewed-on: http://gerrit.openafs.org/5001
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/vol/clone.c

index 0b04756981be9216bfa803e7d01ffc9f5faddf61..b9aff7797d6e58b366d902129950d4cee47e0190 100644 (file)
@@ -175,6 +175,13 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone)
        diskused = V_diskused(rwvp);
     }
 
+    /* Initialize list of inodes to nuke - must do this before any calls
+     * to ERROR_EXIT, as the error handler requires an initialised list
+     */
+    ci_InitHead(&decHead);
+    decRock.h = V_linkHandle(rwvp);
+    decRock.vol = V_parentId(rwvp);
+
     /* Open the RW volume's index file and seek to beginning */
     IH_COPY(rwH, rwvp->vnodeIndex[class].handle);
     rwFd = IH_OPEN(rwH);
@@ -212,11 +219,6 @@ DoCloneIndex(Volume * rwvp, Volume * clvp, VnodeClass class, int reclone)
        STREAM_ASEEK(clfilein, vcp->diskSize);  /* Will fail if no vnodes */
     }
 
-    /* Initialize list of inodes to nuke */
-    ci_InitHead(&decHead);
-    decRock.h = V_linkHandle(rwvp);
-    decRock.vol = V_parentId(rwvp);
-
     /* Read each vnode in the old volume's index file */
     for (offset = vcp->diskSize;
         STREAM_READ(rwvnode, vcp->diskSize, 1, rwfile) == 1;