From: Andrew Deason Date: Wed, 9 Nov 2011 23:04:09 +0000 (-0600) Subject: volser: Preserve needsSalvaged during restore X-Git-Tag: upstream/1.8.0_pre1^2~3068 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=9ba891676a15512fa58915662cf599ea73eac430;p=packages%2Fo%2Fopenafs.git volser: Preserve needsSalvaged during restore Some of the routines during a volume restore may set needsSalvaged, if an inconsistency is detected while writing the given volume data. However, after the data is read, we set the volume header information to what was found in the dump stream, ignoring any needsSalvaged that may have been set. To ensure that inconsistent volumes in this situation actually get demand-salvaged (for DAFS) or offlined (non-DAFS), keep the value of needsSalvaged in the header, if it was set. Change-Id: I575d14d84120be0fbbeb185ed2726f1285e6f2ce Reviewed-on: http://gerrit.openafs.org/5822 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- diff --git a/src/volser/dumpstuff.c b/src/volser/dumpstuff.c index af0fc5a47..3a6639ab5 100644 --- a/src/volser/dumpstuff.c +++ b/src/volser/dumpstuff.c @@ -1226,6 +1226,8 @@ RestoreVolume(struct rx_call *call, Volume * avp, int incremental, vol.cloneId = cookie->clone; vol.parentId = cookie->parent; + V_needsSalvaged(vp) = 0; + tdelo = delo; while (1) { if (ReadVnodes(iodp, vp, 0, b1, s1, b2, s2, tdelo)) { @@ -1267,6 +1269,11 @@ RestoreVolume(struct rx_call *call, Volume * avp, int incremental, clean: ClearVolumeStats(&vol); + if (V_needsSalvaged(vp)) { + /* needsSalvaged may have been set while we tried to write volume data. + * prevent it from getting overwritten. */ + vol.needsSalvaged = V_needsSalvaged(vp); + } CopyVolumeHeader(&vol, &V_disk(vp)); V_destroyMe(vp) = 0; VUpdateVolume(&vupdate, vp);