vol: ensure ih package defaults are set for salvage 78/14378/6
authorMark Vitale <mvitale@sinenomine.net>
Thu, 30 Jul 2020 20:42:19 +0000 (16:42 -0400)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 9 Apr 2021 23:46:57 +0000 (19:46 -0400)
commit9d65bcf8833a826a74fc433777599380cd5b03b9
tree7e60949b805d2f5f780216b7d7efcd9233810ad8
parent896524963ca1f1d8144a668dafefc8ce88ad440b
vol: ensure ih package defaults are set for salvage

Like most OpenAFS components that work with ihandles, salvager relies on
implicit invocation of ih_PkgDefaults via the one-shot in the first call
to IH_INIT.

Unfortunately, there is at least one reachable code path in salvager
that asserts (panics) because vol_io_params has not yet been
initialized.  This is when salvaging a volume group that does not have a
link table; the salvager then panics while attempting to create a new
link table:

SalvageFileSys -> SalvageFileSys1 -> DoSalvageVolumeGroup ->
CreateLinkTable -> IH_CREATE -> namei_icreate -> icreate ->
namei_SetLinkCount -> FDH_SYNC -> ih_fdsync -> osi_Assert(0)

This path was discovered while testing the non-dafs salvager, but it has
also been observed in the field with the DAFS salvageserver.  It is
possible that there are additional undiscovered paths where
vol_io_params are required but uninitialized.

Add an implicit ih_PkgDefaults call to icreate to avoid triggering the
assert via the code path above.

Change-Id: If348d7f8ab2d34d55727b5a6d78db6e1c8e14cdf
Reviewed-on: https://gerrit.openafs.org/14378
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/vol/ihandle.c
src/vol/namei_ops.c