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>
Sun, 24 Nov 2013 17:17:24 +0000 (12:17 -0500)
commit3943dc3a00a56caa9fcef7429d5afe45ea6ae6a3
treee1004e3189ba4ff903221aa34fc809e3f6ff8eb0
parentd39fa10606a9cdeac1d24038525aa4c7ad684e11
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