]> 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>
Thu, 14 Jul 2011 14:32:21 +0000 (07:32 -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.

Reviewed-on: http://gerrit.openafs.org/5001
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
(cherry picked from commit beda3b239a13903d4bcd9a5d91d5ff562962cb5a)

Change-Id: I3e3c4b8565e373f74bb95416e4c9b101d02fd78f
Reviewed-on: http://gerrit.openafs.org/5007
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/vol/clone.c

index f6fb040235bfa37f592ea778fdde53a9614e9371..0841302fe349e00928e31ef12c03f646a1c72f71 100644 (file)
@@ -185,6 +185,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);
@@ -222,11 +229,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;