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.

Reviewed-on: https://gerrit.openafs.org/14137
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 3db8c37e8ef6bea0f03ef6b8f82ed93d52937d7d)

Change-Id: Ied7875e885f51a6d3f00d65f1783df9439a18ae3
Reviewed-on: https://gerrit.openafs.org/15298
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
This commit is contained in:
Andrew Deason 2020-04-05 16:29:52 -05:00 committed by Stephan Wiesand
parent 30dc7fd2ac
commit 80cb460a8b

View File

@ -56,6 +56,11 @@ system: all
install: all $(INSTDIRS)
dest: all $(DESTDIRS)
# Don't let INSTDIRS or DESTDIRS run in parallel with COMPDIRS. They both do
# some work in sub-makes in the same directory that may conflict with each
# other (e.g. generating AFS_component_version_number.c).
$(INSTDIRS) $(DESTDIRS): $(COMPDIRS)
all: setup $(COMPDIRS)
single_compdir single_instdir single_destdir: setup