From 9ba891676a15512fa58915662cf599ea73eac430 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 9 Nov 2011 17:04:09 -0600 Subject: [PATCH] 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 --- src/volser/dumpstuff.c | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.39.5