salvager: Do not require MaybeZapVolume fileName

In MaybeZapVolume, currently we do not remove the volume header if the
given isp->volSummary->fileName is not set. This effectively means
that we only actually "zap" volumes for which we have just created the
header, or which are not referenced by any inodes.

For readonly volumes that have errors, we want to delete the volumes
instead of salvaging. Readonly volumes with valid headers will have
fileName as NULL, though (set back in SalvageFileSys1), so
MaybeZapVolume will refuse to remove them. What ends up happening is
that the headers will stay around, but since we do not finish checking
the volume, all of the inodes for the data in the volume will be
dec'd. This results in a volume whose header exists, but none of its
inodes (including special inodes) exist, so the volume will need to be
salvaged again, and during that salvage will be deleted (because there
are no inodes for the volume).

Avoid all this, and just delete volume headers for volumes that lack a
valid fileName. Instead try to avoid deleting headers with
volSummary->deleted set, just so we don't try to delete the same
headers twice.

Related issue reported by Åsa Andersson.

Change-Id: I4797d0cabe3851debdc78f4ed9ee619534397970
Reviewed-on: http://gerrit.openafs.org/6784
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
This commit is contained in:
Andrew Deason 2012-02-21 17:46:41 -06:00 committed by Derrick Brashear
parent 76f12c2389
commit 8396388709

View File

@ -4240,7 +4240,7 @@ MaybeZapVolume(struct SalvInfo *salvinfo, struct InodeSummary *isp,
char *message, int deleteMe, int check)
{
if (readOnly(isp) || deleteMe) {
if (isp->volSummary && isp->volSummary->fileName) {
if (isp->volSummary && !isp->volSummary->deleted) {
if (deleteMe) {
if (!Showmode)
Log("Volume %u (is only a partial volume--probably an attempt was made to move/restore it when a machine crash occured.\n", isp->volumeId);