Bug 239100 - r348991 breaks unionfs
Summary: r348991 breaks unionfs
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 12.0-STABLE
Hardware: amd64 Any
: --- Affects Many People
Assignee: Konstantin Belousov
Keywords: regression
Depends on:
Reported: 2019-07-10 02:48 UTC by t_uemura
Modified: 2020-11-24 21:21 UTC (History)
1 user (show)

See Also:
koobs: mfc-stable12?
koobs: mfc-stable11?

Select lower/upper vnode for write ref as seems suitable. (1.83 KB, patch)
2019-07-27 15:28 UTC, Konstantin Belousov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description t_uemura 2019-07-10 02:48:10 UTC
With the following commit applied, my unionfs mount is almost dying.

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?
Comment 1 Konstantin Belousov freebsd_committer 2019-07-27 15:27:39 UTC
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.
Comment 2 Konstantin Belousov freebsd_committer 2019-07-27 15:28:46 UTC
Created attachment 206101 [details]
Select lower/upper vnode for write ref as seems suitable.
Comment 3 t_uemura 2019-08-01 05:01:48 UTC
(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.
Comment 4 Mark Johnston freebsd_committer 2020-11-24 21:21:57 UTC
Committed in r350504.