Bug 161511 - [unionfs] Filesystem deadlocks when using multiple unionfs mounts on top of single filesystem
Summary: [unionfs] Filesystem deadlocks when using multiple unionfs mounts on top of s...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-12 05:10 UTC by Enji Cooper
Modified: 2013-02-03 22:29 UTC (History)
0 users

See Also:


Attachments
unionfs_20120409.diff (15.83 KB, patch)
2012-04-09 13:17 UTC, Masanori OZAWA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Enji Cooper freebsd_committer freebsd_triage 2011-10-12 05:10:09 UTC
Mounting a filesystem twice with unionfs like so causes filesystem deadlocks when files are modified on top of unionfs:

#!/bin/sh

mkdir pristine
cat > supfile <<EOF
*default host=cvsup1.freebsd.org
*default base=/FreeBSD/sup
*default prefix=$PWD/FreeBSD
*default release=cvs
*default delete use-rel-suffix
*default compress
EOF
csup supfile
mkdir touched union
mount -t unionfs pristine union
mount -t unionfs touched union
cd union
make buildworld -j4

=====

Any value of -j above -j1 causes filesystem deadlocks; processes like make will block when trying to access directory information -- it's worse for UFS than ZFS because it seems like some structures -- in particular the UFS_DIRHASH -- might be locked indefinitely causing the entire filesystem to become unusable. In either case I've seen the filesystem will prevent rebooting from completing cleanly as there are processes waiting on filesystem resources to become available.

This can also be stimulated via freenas builds like so:

sh build/do_build.sh -U

LORs have also been identified within unionfs around when the deadlock occurs, which might suggest that incorrect locking is preventing unionfs from releasing resources when a [soft] failure occurs. I don't have the LORs right now, but I'm hunting them down in my logs..

How-To-Repeat: See decomposed example above.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-10-14 22:20:54 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Masanori OZAWA 2012-04-09 13:17:14 UTC
Please try this new patch that solves a dead lock issue of unionfs.

# cd /usr/src/
# patch -p3 < attached_file

--
 ONGS Inc.
 Ozawa <ozawa@ongs.co.jp>
 WWW: http://www.ongs.co.jp/
Comment 3 german.mb 2012-05-24 14:34:25 UTC
I can verify this patch absolutely fixes all the issues I was experiencing. M=
y problem was random deadlocking behavior, forcing me to reboot the system m=
anually, when I started/stopped jails using unionfs and/or starting services=
 inside said jails, under FreeBSD 9 RELEASE.=
Comment 4 Daichi GOTO freebsd_committer freebsd_triage 2012-05-25 06:39:59 UTC
State Changed
From-To: open->closed

Committed. Thanks!