Verify and maintain fanout invariants.
authorErez Zadok <ezk@bigvaio.(none)>
Fri, 18 May 2007 05:39:26 +0000 (01:39 -0400)
committerErez Zadok <ezk@cs.sunysb.edu>
Tue, 13 Jan 2009 02:29:46 +0000 (21:29 -0500)
commite49351795b2b9cdfbd049e8fd5ae1ba280ad47bd
treeb0242bc388dd3534f8e4c33297d99a3b5a1897c0
parent536fa6662dabd07a4f3b646ed120eccce61a53cb
Verify and maintain fanout invariants.

This somewhat long patch calls various invariant-checking (debugging)
functions in all places where the fanout invariants should hold.  The three
invariant-checking functions, __unionfs_check_{inode,dentry,file}, perform
exhaustive sanity checking on the fan-out of various Unionfs objects.  We
check that no lower objects exist outside the start/end branch range; that
all objects within are non-NULL (with some allowed exceptions); that for
every lower file there's a lower dentry+inode; that the start/end ranges
match for all corresponding lower objects; that open files/symlinks have
only one lower objects, but directories can have several; and more.

The rest of this patch actually fixes many places where these invariants did
not hold, which could lead to bugs or corruptions under heavy loads,
multi-threaded workloads, dynamic branch-management, and mmap operations.
Most of the bugs related to actions involving copyups and whiteouts.  With
these fixes, the entire Unionfs regression suite passes without a single
invariant violated.
fs/unionfs/commonfops.c
fs/unionfs/copyup.c
fs/unionfs/dentry.c
fs/unionfs/file.c
fs/unionfs/inode.c
fs/unionfs/rename.c
fs/unionfs/unlink.c
fs/unionfs/xattr.c