From: Simon Wilkinson Date: Wed, 13 Jul 2011 13:35:48 +0000 (+0100) Subject: vol: Initialise list before error exit when cloning X-Git-Tag: upstream/1.8.0_pre1^2~3536 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=beda3b239a13903d4bcd9a5d91d5ff562962cb5a;p=packages%2Fo%2Fopenafs.git vol: Initialise list before error exit when cloning 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 Tested-by: Derrick Brashear --- diff --git a/src/vol/clone.c b/src/vol/clone.c index 0b0475698..b9aff7797 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -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;