libafs: Serialize INSTDIRS/DESTDIRS and COMPDIRS 37/14137/2
authorAndrew Deason <adeason@sinenomine.net>
Sun, 5 Apr 2020 21:29:52 +0000 (16:29 -0500)
committerBenjamin Kaduk <kaduk@mit.edu>
Wed, 8 Apr 2020 04:52:10 +0000 (00:52 -0400)
commit3db8c37e8ef6bea0f03ef6b8f82ed93d52937d7d
tree8de305debff0bb717c7b9a35a2e053dff08fdb55
parent80edcab9997807f91798dacc2cc59efdba74be56
libafs: Serialize INSTDIRS/DESTDIRS and COMPDIRS

Our libafs build logic involves a few targets that 'cd' into a
per-kernel subdir: notably INSTDIRS and DESTDIRS (the targets to 'make
install' or 'make dest' our kernel modules) and COMPDIRS (the target
to setup/build the kernel module).

Both of these potentially 'cd' into a subdirectory (e.g. MODLOAD64),
and run some make rules. Since INSTDIRS and COMPDIRS are different
targets and don't depend on each other for many platforms, running
those rules can happen in parallel. After they 'cd' into the relevant
dir, they run a new 'make' in a subshell, and so underlying rules for
building e.g. AFS_component_version_number.c are not serialized.

So for a parallel build on, say, Solaris, we can encounter errors when
two sub-makes try to make AFS_component_version_number.c at the same
time, which looks something like this (with various lines output from
other sub-processes mixed in):

    cd src && cd sys && gmake install
    gmake[3]: Leaving directory '/[...]/src/libuafs'
    rm -f AFS_component_version_number.c.NEW
    /opt/developerstudio12.6/bin/cc [...] -D_KERNEL -DSYSV -dn -m64 -xmodel=kernel -xvector=%none -xregs=no%float  -Wu,-save_args  -o AFS_component_version_number.o -c AFS_component_version_number.c
    mv: cannot access AFS_component_version_number.c.NEW
    gmake[4]: *** [/[...]/src/config/Makefile.version:13: AFS_component_version_number.c] Error 2
    gmake[4]: Leaving directory '/[...]/src/libafs/MODLOAD64'
    gmake[3]: *** [Makefile:85: solaris_instdirs] Error 2
    gmake[3]: *** Waiting for unfinished jobs....

To avoid this, just make INSTDIRS and DESTDIRS depend on COMPDIRS, so
we can make sure they don't run at the same time.

Change-Id: I2510e1894c44dd0864cf2eab5613b805342b6718
Reviewed-on: https://gerrit.openafs.org/14137
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
src/libafs/Makefile.common.in