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)
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

index efc9747..3c01e3a 100644 (file)
@@ -1050,6 +1050,9 @@ ih_icreate(IHandle_t * ih, int dev, char *part, Inode nI, int p1, int p2,
           int p3, int p4)
 {
     Inode ino;
+
+    ih_PkgDefaults();
+
 #ifdef AFS_3DISPARES
     /* See viceinode.h */
     if (p2 == INODESPECIAL) {
index 7704fcd..3c38fe3 100644 (file)
@@ -839,6 +839,8 @@ namei_icreate(IHandle_t * lh, char *part, afs_uint32 p1, afs_uint32 p2, afs_uint
     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;
@@ -972,6 +974,8 @@ icreate(IHandle_t * lh, char *part, afs_uint32 p1, afs_uint32 p2, afs_uint32 p3,
 
     memset((void *)&tmp, 0, sizeof(IHandle_t));
 
+    ih_PkgDefaults();
+
     tmp.ih_dev = volutil_GetPartitionID(part);
     if (tmp.ih_dev == -1) {
        errno = EINVAL;