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>
int p3, int p4)
{
Inode ino;
+
+ ih_PkgDefaults();
+
#ifdef AFS_3DISPARES
/* See viceinode.h */
if (p2 == INODESPECIAL) {
memset((void *)&tmp, 0, sizeof(IHandle_t));
memset(&tfd, 0, sizeof(FdHandle_t));
+ ih_PkgDefaults();
+
tmp.ih_dev = nt_DriveToDev(part);
if (tmp.ih_dev == -1) {
errno = EINVAL;
memset((void *)&tmp, 0, sizeof(IHandle_t));
+ ih_PkgDefaults();
+
tmp.ih_dev = volutil_GetPartitionID(part);
if (tmp.ih_dev == -1) {
errno = EINVAL;