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.6.0.pre7^2~5 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=ccd770e8a38d59619f1972672ac9392e92cfcc7b;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. Reviewed-on: http://gerrit.openafs.org/5001 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit beda3b239a13903d4bcd9a5d91d5ff562962cb5a) Change-Id: I3e3c4b8565e373f74bb95416e4c9b101d02fd78f Reviewed-on: http://gerrit.openafs.org/5007 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/vol/clone.c b/src/vol/clone.c index f6fb04023..0841302fe 100644 --- a/src/vol/clone.c +++ b/src/vol/clone.c @@ -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;