Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Jul 2017 17:54:03 +0000 (UTC)
From:      Bryan Drewery <bdrewery@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r321427 - head/share/mk
Message-ID:  <201707241754.v6OHs3L5016971@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: bdrewery
Date: Mon Jul 24 17:54:03 2017
New Revision: 321427
URL: https://svnweb.freebsd.org/changeset/base/321427

Log:
  PROGS: Fix ESTALE errors on NFS while cleaning in directories with PROGS.
  
  - Only recurse on cleanobj/cleandir if there is no .OBJDIR being used.
    If we don't recurse then bsd.obj.mk will just rm -rf the OBJDIR dir.
  - When recursing on cleanobj/cleandir don't remove dependfiles/dirs
    redundantly from the child and main processes.  Meaning '.depend', and
    'tags', and '.depend.*' will now only be removed from the main
    process.
  - Stop recursing on 'cleandepend' since the main process can handle
    removing all files via the default glob patterns in CLEANDEPENDFILES.
  - This reverts r288201, by readding recursion on 'cleanobj', due to
    r291635 changing how bsd.subdir.mk handles recursion.
  
  This is primarily targeting ESTALE NFS errors from rm(1) during a
  buildworld but is also a performance optimization as both issues fixed
  were redundant anyway.
  
  Reported by:	cperciva, scottl
  MFC after:	2 weeks
  Sponsored by:	Dell EMC Isilon

Modified:
  head/share/mk/bsd.obj.mk
  head/share/mk/bsd.progs.mk

Modified: head/share/mk/bsd.obj.mk
==============================================================================
--- head/share/mk/bsd.obj.mk	Mon Jul 24 17:53:45 2017	(r321426)
+++ head/share/mk/bsd.obj.mk	Mon Jul 24 17:54:03 2017	(r321427)
@@ -157,6 +157,7 @@ whereobj:
 	@echo ${.OBJDIR}
 .endif
 
+# Same check in bsd.progs.mk
 .if ${CANONICALOBJDIR} != ${.CURDIR} && exists(${CANONICALOBJDIR}/)
 cleanobj:
 	-rm -rf ${CANONICALOBJDIR}

Modified: head/share/mk/bsd.progs.mk
==============================================================================
--- head/share/mk/bsd.progs.mk	Mon Jul 24 17:53:45 2017	(r321426)
+++ head/share/mk/bsd.progs.mk	Mon Jul 24 17:54:03 2017	(r321427)
@@ -116,7 +116,16 @@ ${_PROGS_COMMON_OBJS}: .NOMETA
 
 .if !empty(PROGS) && !defined(_RECURSING_PROGS) && !defined(PROG)
 # tell progs.mk we might want to install things
-PROGS_TARGETS+= checkdpadd clean cleandepend cleandir depend install
+PROGS_TARGETS+= checkdpadd clean depend install
+# Only handle removing depend files from the main process.
+_PROG_MK.cleandir=	CLEANDEPENDFILES= CLEANDEPENDDIRS=
+_PROG_MK.cleanobj=	CLEANDEPENDFILES= CLEANDEPENDDIRS=
+# Only recurse on these if there is no objdir, meaning a normal
+# 'clean' gets ran via the target defined in bsd.obj.mk.
+# Same check from cleanobj: in bsd.obj.mk
+.if ${CANONICALOBJDIR} == ${.CURDIR} || !exists(${CANONICALOBJDIR}/)
+PROGS_TARGETS+=	cleandir cleanobj
+.endif
 
 # Ensure common objects are built before recursing.
 .if !empty(_PROGS_COMMON_OBJS)
@@ -142,7 +151,7 @@ $p.$t: .PHONY .MAKE
 	(cd ${.CURDIR} && \
 	    DEPENDFILE=.depend.$p \
 	    NO_SUBDIR=1 ${MAKE} -f ${MAKEFILE} _RECURSING_PROGS=t \
-	    PROG=$p ${x.$p} ${@:E})
+	    ${_PROG_MK.${t}} PROG=$p ${x.$p} ${@:E})
 .endfor
 .endfor
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201707241754.v6OHs3L5016971>