With the following commit applied, my unionfs mount is almost dying. https://svnweb.freebsd.org/base?view=revision&revision=348991 MFC r347151,347181,347968,348421,348698,348701: Switch to use shared vnode locks for text files during image activation. Mine is running FreeBSD 12.0-STABLE FWINA amd64 as of 19 June 2019 and my unionfs setup is as follows. /dev/nda0p2 on / (ufs, NFS exported, local, noatime, journaled soft-updates) devfs on /dev (devfs, local) <below>:/usr/portsl on /usr/ports (unionfs, local, noatime) For example, I tried to build perl5 port by executing make build in /usr/ports/lang/perl5.30 and I got something like this. Checking for GNU cc in disguise and/or its version number... Now, how can we feed standard input to your C preprocessor... ./Configure: cannot create testcpp.out: Text file busy ./Configure: cannot create testcpp.out: Text file busy ./Configure: cannot create testcpp.out: Text file busy ./Configure: cannot create testcpp.out: Text file busy ./Configure: cannot create testcpp.out: Text file busy No dice. I can't find a C preprocessor. Name one: ^C===> Script "Configure" failed unexpectedly. Please report the problem to mat@FreeBSD.org [maintainer] and attach the "/usr/ports/lang/perl5.30/work/perl-5.30.0/config.log" including the output of the failure of your make command. Also, it might be a good idea to provide an overview of all packages installed on your system (e.g. a /usr/local/sbin/pkg-static info -g -Ea). *** Error code 1 The actual errors I got vary time to time but most of them are Text file busy at some point during configure/build phase, and almost all the time the builds fail to finish. By specifying WRKDIRPREFIX outside the unionfs such as WRKDIRPREFIX=/tmp works around the error, or by backing out the whole r348991 commit also fixes. By reverting only sys/fs/unionfs/union_subr.c to r339434 doesn't work. Any ideas?
unionfs is not maintained. Try the patch I attached, I am not set up to test it. I am not sure if there are corner cases where e.g. upper vnode could be created when lower vnode is executed.
Created attachment 206101 [details] Select lower/upper vnode for write ref as seems suitable.
(In reply to Konstantin Belousov from comment #2) Thank you for making a patch. Indeed it solved the problem. Although the unionfs isn't officially supported, now it is working as expected without any hitch.
Committed in r350504.