DAFS: Fix demand-salvages of attached volumes
authorAndrew Deason <adeason@sinenomine.net>
Fri, 2 Jul 2010 21:57:42 +0000 (16:57 -0500)
committerDerrick Brashear <shadow@dementia.org>
Tue, 2 Nov 2010 11:43:49 +0000 (04:43 -0700)
commit0aa7fac246ce044c757530ebe96d3a05c2f33894
tree52ffd8ef94db7e2af4faa314fd08b0b775800448
parent138ac6577eab40e25a796f7c18f3c39add000ed2
DAFS: Fix demand-salvages of attached volumes

Currently, when an error is encountered for an attached volume, we
call VRequestSalvage_r, which makes the volume go into the
VOL_STATE_SALVAGING state. This state implies that the volume is
offline, however, which is not necessarily the case if we're calling
VRequestSalvage_r from, for example, VAllocVnode_r or VUpdateVolume_r.

So now, make a new state called VOL_STATE_SALVAGE_REQ to indicate when
a salvage has been requested but the volume is not offline yet (and
thus is not yet ready to give to the salvager). If VCheckSalvage finds
a volume in this state, it offlines the volume first. The FSSYNC
VOL_OFF handler now checks for this state, and if we're giving the
volume to the salvager, we wait for the volume to exit that state.

VRequestSalvage_r also gains a new flag, VOL_SALVAGE_NO_OFFLINE. This
is to ensure that the existing salvaging code paths for unattached
volumes does not change (for when VRequesetSalvage_r is called from
attach2). If this flag is passed, we do what we used to do, which is
just salvage the volume without offlining it.

Change-Id: Ie709ac7013ab2b52c87fa408c254651abe5e6af3
Reviewed-on: http://gerrit.openafs.org/2329
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/vol/fssync-debug.c
src/vol/fssync-server.c
src/vol/volume.c
src/vol/volume.h
src/vol/volume_inline.h