unionfs-2.6.39.y.git
17 years agoUnionfs: fix minor typo in a comment
Erez_Zadok [Fri, 13 Jul 2007 06:40:31 +0000 (02:40 -0400)]
Unionfs: fix minor typo in a comment

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: use the splice_read file method instead of sendfile
Erez_Zadok [Wed, 11 Jul 2007 20:13:07 +0000 (16:13 -0400)]
Unionfs: use the splice_read file method instead of sendfile

In 2.6.23 (prior to rc1), sendfile was obsoleted in favor of splice_read.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agounionfs: better handling when copying up permissions
Erez_Zadok [Tue, 10 Jul 2007 00:19:08 +0000 (20:19 -0400)]
unionfs: better handling when copying up permissions

When we copyup a file, directory, or symlink, we may be copying up from one
file system type to another.  The destination file system may not support
all of the features of the source file system, and the differences in
support may be minor.  For example jffs2 doesn't allow one to chmod a
symlink (and it returns a -EOPNOTSUPP).  So we ignore such harmless errors,
rather than propagating them up, which results in copyup errors and errors
returned back to users.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: better error handling in rename code when copyups are involved
Erez_Zadok [Tue, 10 Jul 2007 00:14:41 +0000 (20:14 -0400)]
Unionfs: better error handling in rename code when copyups are involved

First, rewrite code slightly and document it better to explain why we appear
to ignore copyup errors (because we try the next branch to the left).

Second, change a BUG_ON to a printk(KERN_ERR), because a mild failure to
copyup a file should not cause an oops.  For example, some file systems
don't support UIDs/GIDs (e.g., VFAT) and others don't allow you to chmod a
symlink (e.g., jffs2), possibly resulting in mild copyup failures; that
shouldn't be considered so severe as to cause an oops.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: bugfix when renaming symlinks on readonly branches
Erez_Zadok [Sun, 8 Jul 2007 01:31:28 +0000 (21:31 -0400)]
Unionfs: bugfix when renaming symlinks on readonly branches

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: prevent deadlock with branch-management code.
Erez_Zadok [Tue, 3 Jul 2007 13:14:39 +0000 (09:14 -0400)]
Unionfs: prevent deadlock with branch-management code.

Don't grab the superblock read-lock in unionfs_permission, which prevents a
deadlock with the branch-management "add branch" code (which grabbed the
write lock).  It is safe to not grab the read lock here, because even with
branch management taking place, there is no chance that unionfs_permission,
or anything it calls, will use stale branch information.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: rename file->f_dentry references to file->f_path.dentry
Erez_Zadok [Fri, 29 Jun 2007 06:33:14 +0000 (02:33 -0400)]
Unionfs: rename file->f_dentry references to file->f_path.dentry

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: improved comment above unionfs_follow_link
Erez_Zadok [Fri, 29 Jun 2007 06:02:42 +0000 (02:02 -0400)]
Unionfs: improved comment above unionfs_follow_link

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: Change the semantics of sb info's rwsem
Erez_Zadok [Fri, 29 Jun 2007 06:00:24 +0000 (02:00 -0400)]
Unionfs: Change the semantics of sb info's rwsem

This rw semaphore is used to make sure that a branch management
operation...

1) will not begin before all currently in-flight operations complete

2) any new operations do not execute until the currently running branch
management operation completes

Reworked the patch a bit, added comments, and fixed some bugs, from the
version originally committed into the master branch.

TODO: rename the functions unionfs_{read,write}_{,un}lock() to something
more descriptive.

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: Remove superfluous check for NULL pointer
Erez_Zadok [Fri, 29 Jun 2007 04:45:47 +0000 (00:45 -0400)]
Unionfs: Remove superfluous check for NULL pointer

Since we use containers and the struct inode is _inside_ the
unionfs_inode_info structure, UNIONFS_I will always (given a non-NULL inode
pointer), return a valid non-NULL pointer.

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Conflicts:

fs/unionfs/super.c

17 years agoUnionfs: Change free_dentry_private_info to take a struct dentry
Josef 'Jeff' Sipek [Fri, 8 Jun 2007 14:58:22 +0000 (10:58 -0400)]
Unionfs: Change free_dentry_private_info to take a struct dentry

This makes it more symmetric with new_dentry_private_info.

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
17 years agoUnionfs: Cleanup new_dentry_private_data
Erez_Zadok [Fri, 29 Jun 2007 04:36:08 +0000 (00:36 -0400)]
Unionfs: Cleanup new_dentry_private_data

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Conflicts:

fs/unionfs/lookup.c

17 years agoUnionfs: document cache-coherency design and implementation
Erez_Zadok [Mon, 18 Jun 2007 02:39:38 +0000 (22:39 -0400)]
Unionfs: document cache-coherency design and implementation

Document our cache-coherency design, implementation; also mention alternate
designs and a couple of limitations which might be overcome by special
kernel support at the VFS/MM levels.  Now that cache-coherency is working,
remove the now-obsolete older discussion of temporary workarounds.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: cache-coherency calls to maintain the time invariants
Erez_Zadok [Mon, 18 Jun 2007 02:39:05 +0000 (22:39 -0400)]
Unionfs: cache-coherency calls to maintain the time invariants

This patch represents several types of related changes.  First, we invoke
functions to synchronize the upper and lower times as and when needed.  Many
of these were bug fixes which were discovered during the development of the
cache-coherency code.  That is, Unionfs itself wasn't maintaining
appropriate
times in some places, which if not fixed would have been detected by the
invariant-checking code as a false positive (incorrectly considered as if a
user modified the lower objects directly).

Second, we do not call invariant-validation functions (unionfs_check_file,
unionfs_check_dentry, etc.) until *after* we've revalidated them.  Otherwise
we produced false positives.

Third, we pass a flag "willwrite" to __unionfs_d_revalidate_chain to tell it
to purge data pages if the inode lower times appear to be newer.

See Documentation/filesystems/unionfs/concepts.txt under the "Cache
Coherency" section for more details of this design and implementation.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: core cache-coherency code
Erez_Zadok [Mon, 18 Jun 2007 02:37:54 +0000 (22:37 -0400)]
Unionfs: core cache-coherency code

This represents the core of the cache-coherency code, the code which
maintains time-based invariants; the lower objects should never be newer
than the upper Unionfs objects.  If they are newer, then it means that a
user has modified the lower Unionfs branches directly.  If so, then we have
to revalidate our objects by rebuilding them, and possibly discard any stale
data or meta-data.  See Documentation/filesystems/unionfs/concepts.txt under
the "Cache Coherency" section for more details of this design and
implementation.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: introduce two functions to maintain time invariants
Erez_Zadok [Mon, 18 Jun 2007 02:36:55 +0000 (22:36 -0400)]
Unionfs: introduce two functions to maintain time invariants

A new function unionfs_copy_attr_times to maintain the inode time invariants
as per the Unionfs design (i.e., lower times should never be newer than our
times), as documented in Documentation/filesystems/unionfs/concepts.txt.
The second function, unionfs_copy_attr_all, is the unionfs-specific function
to copy all attributes: it uses the special Unionfs handling of hard-links
(via unionfs_get_nlinks) and it uses the special a/c/mtime handling (via
unionfs_copy_attr_times).  This second function is the special
fanout-version of fsstack_copy_attr_all, which was simplified for
linear-stack stackable file systems.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: prototype and location change for unionfs_get_nlinks
Erez_Zadok [Mon, 18 Jun 2007 02:36:03 +0000 (22:36 -0400)]
Unionfs: prototype and location change for unionfs_get_nlinks

Change prototype of unionfs_get_nlinks to take a const inode.  Also move
extern for unionfs_get_nlinks so it can be refereed to in other Unionfs
header files.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoecryptfs: update to new API of fsstack_copy_attr_all
Erez_Zadok [Mon, 18 Jun 2007 02:35:25 +0000 (22:35 -0400)]
ecryptfs: update to new API of fsstack_copy_attr_all

Remove obsolete third argument to fsstack_copy_attr_all which was always
NULL for ecryptfs.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agofs_stack: simplify generic attribute-copying function
Erez_Zadok [Mon, 18 Jun 2007 02:34:47 +0000 (22:34 -0400)]
fs_stack: simplify generic attribute-copying function

Remove special get_nlinks callback from fsstack_copy_attr_all, because the
callback was only used by Unionfs (and always used by Unionfs).  Unionfs now
needs a more complex version of fsstack_copy_attr_all, with two callbacks:
therefore it's easier to simplify this method for simple linear-stacking
stackable file system, and introduce a more complex fan-out version of it
for Unionfs.

This is an API change which requires that every stackable file system in the
kernel be updated to reflect that (currently only eCryptfs).

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: m/c/atime invariant checking debugging code
Erez_Zadok [Mon, 18 Jun 2007 02:33:56 +0000 (22:33 -0400)]
Unionfs: m/c/atime invariant checking debugging code

Add checks to verify that lower inode times are not newer than our own inode
times.  Introduce two useful utility debugging functions to print inode
times.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: bugfix in debugging infrastructure
Erez_Zadok [Mon, 18 Jun 2007 02:29:40 +0000 (22:29 -0400)]
Unionfs: bugfix in debugging infrastructure

Off-by-one bug fixed in range checking for lower directories.
Ensure that we PRINT_CALLER before an additional debug message.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoCache coherency: resync unionfs data/meta-data when lower files change
Erez_Zadok [Mon, 11 Jun 2007 16:48:29 +0000 (12:48 -0400)]
Cache coherency: resync unionfs data/meta-data when lower files change

Whenever we revalidate a file or dentry, we check to see if any of the lower
inodes have changed (new mtime/ctime).  If so, we revalidate the upper
unionfs objects.  This method "works" in that as long as a user process will
have caused unionfs to be called, directly or indirectly, even to just do
->d_revalidate, then we will have purged the current unionfs data and the
process will see the new data.  For example, a process that continually
re-reads the same file's data will see the NEW data as soon as the lower
file had changed, upon the next read(2) syscall.  This also works for
meta-data changes which change the ctime (chmod, chown, chgrp, etc).

However, this doesn't work when the process re-reads the file's data via
mmap and the data was already read before via mmap: once we respond to
->readpage(s), then the kernel maps the page into the process's address
space and there doesn't appear to be a way to force the kernel to invalidate
those pages/mappings, and force the process to re-issue ->readpage.  Note:
only pages that have already been readpage'ed are not updated; any other
pages which unionfs's ->readpage would be called on, WILL get the updated
data.  If there's a way to invalidate active mappings and force a
->readpage, let us know please (invalidate_inode_pages2 doesn't do the
trick).

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agorevert changes to new_dentry_private_data and document it
Erez_Zadok [Mon, 11 Jun 2007 14:52:21 +0000 (10:52 -0400)]
revert changes to new_dentry_private_data and document it

Revert bad changes to this function, but this time explain better its precise
semantics.  It can take a dentry whose private unionfs 'info' node exists or
not, and it should allocate and un/lock it only if it's NULL.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agocleanup: convert all instances of "hidden" to "lower".
Erez_Zadok [Sun, 10 Jun 2007 23:04:30 +0000 (19:04 -0400)]
cleanup: convert all instances of "hidden" to "lower".

The unionfs code contained many references to symbols whose name had the
string "hidden" in it, referring to, for example, a "hidden inode" below the
unionfs inode.  The term "hidden" was there for historical reasons and was a
misnomer, implying that the objects at unionfs's lower branches were somehow
hidden or unavailable.  This was not just incorrect, but confusing.  The
lower objects are just that: lower.  They are not hidden from users.  In
fact, users can 'cd' to lower branches and manipulate files directly there.
This long patch renames all such mis-named symbols, and re-indents the code
as needed to comply with coding standards.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoFix section marker in header file:
Erez_Zadok [Sun, 10 Jun 2007 21:55:23 +0000 (17:55 -0400)]
Fix section marker in header file:

WARNING: fs/unionfs/unionfs.o(.init.text+0x56): Section mismatch: reference to .exit.text:stop_sioq (between 'init_module' and 'init_sioq')

Signed-off-by: Randy Dunlap <randy.dunlap@oracle.com>
Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agominor indentation correction
Erez_Zadok [Sun, 10 Jun 2007 21:51:42 +0000 (17:51 -0400)]
minor indentation correction

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobugfix: add MODULE_LICENSE to mtdsuper module so it loads
Erez_Zadok [Wed, 6 Jun 2007 05:20:15 +0000 (01:20 -0400)]
bugfix: add MODULE_LICENSE to mtdsuper module so it loads

This is a temp fix in rc4.  Also reported this bug to MTD maintainer.

17 years agobugfix: properly reset lower inode start/end range
Erez_Zadok [Wed, 6 Jun 2007 01:58:07 +0000 (21:58 -0400)]
bugfix: properly reset lower inode start/end range

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agocleanup: rewrite new_dentry_private data more simply
Erez_Zadok [Sun, 3 Jun 2007 06:27:37 +0000 (02:27 -0400)]
cleanup: rewrite new_dentry_private data more simply

Also remove unnecessary variables and statements.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobugfix: remove extra superblock rwsem unlock call
Erez_Zadok [Sun, 3 Jun 2007 06:26:36 +0000 (02:26 -0400)]
bugfix: remove extra superblock rwsem unlock call

This also makes the code more symmetric: the same code which locks also
unlocks the rwsem.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoremove unnecessary comment
Erez_Zadok [Fri, 1 Jun 2007 04:47:20 +0000 (00:47 -0400)]
remove unnecessary comment

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoproperly format a multi line comment
Erez_Zadok [Fri, 1 Jun 2007 04:01:03 +0000 (00:01 -0400)]
properly format a multi line comment

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoreformat all lines longer than 80 characters
Erez_Zadok [Fri, 1 Jun 2007 03:34:59 +0000 (23:34 -0400)]
reformat all lines longer than 80 characters

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agodebugging: indent code properly and cleanups
Erez_Zadok [Fri, 1 Jun 2007 03:13:14 +0000 (23:13 -0400)]
debugging: indent code properly and cleanups

Also make PRINT_CALLER look like a function.
Fix one small bug in __show_branch_counts.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agocleanup: reformat all lines longer than 80 characters
Erez_Zadok [Fri, 1 Jun 2007 02:32:10 +0000 (22:32 -0400)]
cleanup: reformat all lines longer than 80 characters

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agospell check all strings and comments
Erez_Zadok [Thu, 31 May 2007 19:53:28 +0000 (15:53 -0400)]
spell check all strings and comments

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agocleanup: ensure proper comment on every "#endif"
Erez_Zadok [Thu, 31 May 2007 19:30:55 +0000 (15:30 -0400)]
cleanup: ensure proper comment on every "#endif"

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoRevert "Unionfs: Cleanup locking in new_dentry_private_data"
Erez_Zadok [Thu, 31 May 2007 03:34:23 +0000 (23:34 -0400)]
Revert "Unionfs: Cleanup locking in new_dentry_private_data"

This reverts commit ad2d6a5f5e0501ecf704bf2c748e9818ee8e019b.

Conflicts:

fs/unionfs/lookup.c

17 years agobugfix: ensure dentry/inode/mnt validity after a successful ioctl
Erez_Zadok [Thu, 31 May 2007 00:14:07 +0000 (20:14 -0400)]
bugfix: ensure dentry/inode/mnt validity after a successful ioctl

We call unionfs_partial_lookup in our queryfile ioctl method, so we can find
all instances of a lower object to report back to a suer.  This can violate
the fanout invariants (e.g., a regular file should have only one lower
object active at a time).  So we have to re-establish the invariants on the
lower dentries, inodes, and mnts.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobugfix: release superblock lock at end of ioctl method
Erez_Zadok [Thu, 31 May 2007 00:09:07 +0000 (20:09 -0400)]
bugfix: release superblock lock at end of ioctl method

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobug fixes: revalidate dentries passed to all inode/super operations
Erez_Zadok [Wed, 30 May 2007 05:02:20 +0000 (01:02 -0400)]
bug fixes: revalidate dentries passed to all inode/super operations

Be sure to properly revalidate all dentry chains passed to all inode and
super_block operations.  Remove the older BUG_ON test is_valid_dentry().
This should help improve cache-coherency.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agocode consistency: ensure that every #endif has a matching comment
Erez_Zadok [Wed, 30 May 2007 02:09:59 +0000 (22:09 -0400)]
code consistency: ensure that every #endif has a matching comment

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoinvariants: don't complain if no lower dentry of a deleted dentry
Erez_Zadok [Tue, 29 May 2007 03:24:58 +0000 (23:24 -0400)]
invariants: don't complain if no lower dentry of a deleted dentry

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoinvariants: don't complain about directories with some NULL lower objects
Erez_Zadok [Mon, 28 May 2007 23:47:35 +0000 (19:47 -0400)]
invariants: don't complain about directories with some NULL lower objects

Directories can have NULL lower objects in between start/end, but NOT if at
the start/end range.  We cannot verify that this dentry is a type=DIR,
because it may already be a negative dentry.  But if dbstart is greater than
dbend, we know that this couldn't have been a regular file: it had to have
been a directory.  In that case, don't complain about NULL lower objects in
in between start/end.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoRevert "invariants: don't complain about directories with some NULL lower objects"
Erez_Zadok [Mon, 28 May 2007 23:45:45 +0000 (19:45 -0400)]
Revert "invariants: don't complain about directories with some NULL lower objects"

This reverts commit 9d8ee83d478be30faf351af7628066ec6658efb5.

17 years agoinvariants: don't complain about directories with some NULL lower objects
Erez_Zadok [Mon, 28 May 2007 23:42:20 +0000 (19:42 -0400)]
invariants: don't complain about directories with some NULL lower objects

Directories can have NULL lower objects in between start/end, but NOT if at
the start/end range.  We cannot verify that this dentry is a type=DIR,
because it may already be a negative dentry.  But if dbstart is greater than
dbend, we know that this couldn't have been a regular file: it had to have
been a directory.  In that case, don't complain about NULL lower objects in
in between start/end.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agocleanup: rewrite unionfs_partial_lookup more cleanly and add comments
Erez_Zadok [Mon, 28 May 2007 23:39:44 +0000 (19:39 -0400)]
cleanup: rewrite unionfs_partial_lookup more cleanly and add comments

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobug fix: prevent null mntget warning messages in unionfs_lookup_backend
Erez_Zadok [Mon, 28 May 2007 23:38:14 +0000 (19:38 -0400)]
bug fix: prevent null mntget warning messages in unionfs_lookup_backend

Don't try to mntget a lower mnt at a point where the lower mnts don't yet
exist (the callers will have them later on).  Instead, get the lower mnt of
the sb->s_root.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agodocumentation: expand comments to unionfs_lookup_backend
Erez_Zadok [Mon, 28 May 2007 23:36:02 +0000 (19:36 -0400)]
documentation: expand comments to unionfs_lookup_backend

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agocleanup: remove unnecessary call to inherit_mnt
Erez_Zadok [Mon, 28 May 2007 23:23:42 +0000 (19:23 -0400)]
cleanup: remove unnecessary call to inherit_mnt

Our unionfs_lookup doesn't need to call inherit_mnt: the lower mnts will be
correct here (but not if other methods such as unionfs_rename call our
lookup_backend helper function directly).

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobug fix: don't warn if trying to mntput a "negative" union object
Erez_Zadok [Mon, 28 May 2007 23:21:21 +0000 (19:21 -0400)]
bug fix: don't warn if trying to mntput a "negative" union object

In unionfs_d_release, we may get negative dentries which don't have a lower
mnt.  In that case, don't print a warning message from unionfs_mntput about
trying to put a NULL mnt.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobug fix: get lower mnt from root dentry instead of lower dentry
Erez_Zadok [Mon, 28 May 2007 23:18:45 +0000 (19:18 -0400)]
bug fix: get lower mnt from root dentry instead of lower dentry

While copying-up a file, the union object hasn't been fully formed yet, so
we don't have all the lower dentries/mnts to use (the caller will have them
later on).  Therefore, we should use the sb->s_root's lower mnt here.  This
fixes a "NULL mnt" warning message that came from unionfs_mntget.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: allow users to override Makefile options in fs/unionfs/local.mk
Erez_Zadok [Sat, 26 May 2007 02:36:13 +0000 (22:36 -0400)]
Unionfs: allow users to override Makefile options in fs/unionfs/local.mk

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agodocumentation: better comment in branch_id_to_idx
Erez_Zadok [Sat, 26 May 2007 02:01:03 +0000 (22:01 -0400)]
documentation: better comment in branch_id_to_idx

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobug fix: catch bad use of dirs= options (extra ':' separators)
Erez_Zadok [Fri, 25 May 2007 21:01:00 +0000 (17:01 -0400)]
bug fix: catch bad use of dirs= options (extra ':' separators)

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agounionfs: merge find_new_branch_index and branch_id_to_idx into one function
Erez_Zadok [Fri, 25 May 2007 20:20:36 +0000 (16:20 -0400)]
unionfs: merge find_new_branch_index and branch_id_to_idx into one function

Useful code cleanup and consolidation between the ODF code and non-ODF code.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agounionfs: minor cleanup and better commenting in new_dentry_private_data
Erez_Zadok [Fri, 25 May 2007 19:47:44 +0000 (15:47 -0400)]
unionfs: minor cleanup and better commenting in new_dentry_private_data

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: Cleanup locking in new_dentry_private_data
Erez_Zadok [Fri, 25 May 2007 19:45:30 +0000 (15:45 -0400)]
Unionfs: Cleanup locking in new_dentry_private_data

Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
Conflicts:

fs/unionfs/lookup.c

17 years agobugfix: prevent null-deref oops if lower f/s is NFS (mmap writes)
Erez_Zadok [Fri, 25 May 2007 19:37:38 +0000 (15:37 -0400)]
bugfix: prevent null-deref oops if lower f/s is NFS (mmap writes)

This is a workaround fora deficiency of the linux MM layer, which doesn't
allow clean coordination between upper and lower pages in stackable layers.
We prevent an oops, but the cost is that we're not able to implement
writepages cleanly, not can we call the lower file system's writepages.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agocleanup: use krealloc instead of open-coding it with kmalloc/kfree/memcpy
Erez_Zadok [Thu, 24 May 2007 04:08:03 +0000 (00:08 -0400)]
cleanup: use krealloc instead of open-coding it with kmalloc/kfree/memcpy

17 years agobugfix: prevent a NULL ptr deref if branch is nfs and using mmap writes
Erez_Zadok [Thu, 24 May 2007 01:27:58 +0000 (21:27 -0400)]
bugfix: prevent a NULL ptr deref if branch is nfs and using mmap writes

By some strange condition, the VFS can pass our unionfs_writepage a
writeback_control structure which, if passed as is to the lower ->writepage
-- here nfs_writepage, triggers a NULL ptr deref in NFS.  This fix works
around this issue, and results in a successfully written mmaped file.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobugfix: handle lower file systems that do not support writeable mappings
Erez_Zadok [Thu, 24 May 2007 01:26:01 +0000 (21:26 -0400)]
bugfix: handle lower file systems that do not support writeable mappings

File systems such as jffs2 (tested in 2.6.22-rc22) do not have a
->writepage.  Make sure unionfs detects that conditions and returns EINVAL
when a user tries to mmap such a file with VM_WRITE.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agodocumentation: comment to ODF developers to address
Erez Zadok [Wed, 23 May 2007 03:53:25 +0000 (23:53 -0400)]
documentation: comment to ODF developers to address

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobug fix: set lower inodes correctly after branch management succeeds
Erez Zadok [Wed, 23 May 2007 03:52:12 +0000 (23:52 -0400)]
bug fix: set lower inodes correctly after branch management succeeds

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobug fix: prevent self deadlock with remount code in pivot_root scenarios
Erez Zadok [Wed, 23 May 2007 03:50:44 +0000 (23:50 -0400)]
bug fix: prevent self deadlock with remount code in pivot_root scenarios

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agodebugging: test for freed (0x5a) inodes
Erez Zadok [Wed, 23 May 2007 03:49:35 +0000 (23:49 -0400)]
debugging: test for freed (0x5a) inodes

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agobugfix: statfs lower file system properly
Erez Zadok [Tue, 22 May 2007 22:04:14 +0000 (18:04 -0400)]
bugfix: statfs lower file system properly

Get the correct lower dentry to use to statfs the first branch (always), now
works with disk-based as well as network file systems.  Also document the
code better.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoAdd Erez Zadok to maintainers list
Erez_Zadok [Sun, 20 May 2007 01:11:22 +0000 (21:11 -0400)]
Add Erez Zadok to maintainers list

17 years agoadd standard copyright comment to linux/union_fs.h
Erez_Zadok [Sun, 20 May 2007 01:07:29 +0000 (21:07 -0400)]
add standard copyright comment to linux/union_fs.h

17 years agod_splice bugfix: update dentry in our lookup if needed.
Erez_Zadok [Sun, 20 May 2007 00:44:25 +0000 (20:44 -0400)]
d_splice bugfix: update dentry in our lookup if needed.

17 years agommap: file revalidation and fanout invariant validation
Erez_Zadok [Sat, 19 May 2007 23:59:13 +0000 (19:59 -0400)]
mmap: file revalidation and fanout invariant validation

Added the newer checks to file revalidation and fanout invariants to the
newly merged mmap code.  Also minor mmap related comments added.

17 years agommap: sync_page bug, call sync_page on lower page, not unionfs page
Yiannis Pericleous [Sat, 19 May 2007 19:23:22 +0000 (15:23 -0400)]
mmap: sync_page bug, call sync_page on lower page, not unionfs page

17 years agommap: also revalidate file passed to unionfs_release
Erez_Zadok [Sat, 19 May 2007 23:17:30 +0000 (19:17 -0400)]
mmap: also revalidate file passed to unionfs_release

Conflicts:

fs/unionfs/commonfops.c

17 years agommap: update atime upon successful file reading (via mmap or otherwise)
Erez_Zadok [Sun, 6 May 2007 00:41:46 +0000 (20:41 -0400)]
mmap: update atime upon successful file reading (via mmap or otherwise)

17 years agommap: proper locking to interoperate with branch-management code
Erez_Zadok [Sat, 5 May 2007 23:27:33 +0000 (19:27 -0400)]
mmap: proper locking to interoperate with branch-management code

Include proper read un/lock calls as in file.c.  Make unionfs_do_readpage
static as no one else should call this helper function.

17 years agommap: remove unnecessary unionfs_bmap method
Erez_Zadok [Sat, 5 May 2007 23:15:28 +0000 (19:15 -0400)]
mmap: remove unnecessary unionfs_bmap method

Unionfs is not a block-based file system, so it should not define ->bmap.

17 years agommap: trivial sendfile support
Erez_Zadok [Sat, 5 May 2007 23:10:00 +0000 (19:10 -0400)]
mmap: trivial sendfile support

17 years agommap: minor code and comment reformatting
Erez_Zadok [Sat, 19 May 2007 23:10:42 +0000 (19:10 -0400)]
mmap: minor code and comment reformatting

Conflicts:

fs/unionfs/file.c

17 years agommap: #if 0 unneeded code instead of commenting it out
Yiannis Pericleous [Tue, 1 May 2007 23:11:53 +0000 (19:11 -0400)]
mmap: #if 0 unneeded code instead of commenting it out

17 years agommap: read upper file instead of lower file
Yiannis Pericleous [Tue, 1 May 2007 19:18:39 +0000 (15:18 -0400)]
mmap: read upper file instead of lower file

dont touch atimes on reads

17 years agommap: coding style: reformated a line longer than 80 chars
Yiannis Pericleous [Sun, 29 Apr 2007 02:04:54 +0000 (22:04 -0400)]
mmap: coding style: reformated a line longer than 80 chars

17 years agommap: remove defunct comments
Erez_Zadok [Sun, 29 Apr 2007 01:04:05 +0000 (21:04 -0400)]
mmap: remove defunct comments

17 years agommap: file revalidation
Yiannis Pericleous [Fri, 27 Apr 2007 22:13:29 +0000 (18:13 -0400)]
mmap: file revalidation

17 years agommap: applied main mmap patch
Erez_Zadok [Sat, 19 May 2007 23:00:51 +0000 (19:00 -0400)]
mmap: applied main mmap patch

Resolved the following conflicts:

Conflicts:

fs/unionfs/Makefile
fs/unionfs/file.c

17 years agobugfix: fixed interpose to check if d_splice_alias returns a dentry
Erez_Zadok [Sat, 19 May 2007 22:22:53 +0000 (18:22 -0400)]
bugfix: fixed interpose to check if d_splice_alias returns a dentry

Also in unionfs_interpose, ensure that this new dentry's private data is
correct.  unionfs_interpose now returns a dentry if d_splice_alias has
returned a dentry.  (This is a reimplementation of the same fix from the ODF
code base.)

17 years agodebug: remove unnecessarily verbose debugging printk's
Erez_Zadok [Sat, 19 May 2007 21:14:27 +0000 (17:14 -0400)]
debug: remove unnecessarily verbose debugging printk's

17 years agocleanup: consistent printk messages
Erez_Zadok [Sat, 19 May 2007 20:40:16 +0000 (16:40 -0400)]
cleanup: consistent printk messages

17 years agocleanup: eliminate wrapper function create_parents
Erez Zadok [Fri, 18 May 2007 07:41:05 +0000 (03:41 -0400)]
cleanup: eliminate wrapper function create_parents

Eliminate simple wrapper function create_parents which trivially called
create_parents_named with one more arg derived from the caller.  Instead,
remove the wrapper, rename create_parents_named to create_parents, and make
everyone call create_parents directly.  This clarifies the code a bit more
and saves a bit on stack space.

17 years agocleanup: eliminate wrapper function copyup_dentry
Erez Zadok [Fri, 18 May 2007 07:27:02 +0000 (03:27 -0400)]
cleanup: eliminate wrapper function copyup_dentry

Eliminate simple wrapper function copyup_dentry which trivially called
copyup_named_dentry with 2 more args derived from the caller.  Instead,
remove the wrapper, rename copyup_named_dentry to copyup_dentry, and make
everyone call copyup_dentry directly.  This clarifies the code a bit more
and saves a bit on stack space.

17 years agocleanup: rewrite do_delayed_copyup more cleanly and clearly
Erez Zadok [Fri, 18 May 2007 07:07:37 +0000 (03:07 -0400)]
cleanup: rewrite do_delayed_copyup more cleanly and clearly

17 years agodebugging: small fix to Makefile to correct #define typo
Erez Zadok [Fri, 18 May 2007 06:18:44 +0000 (02:18 -0400)]
debugging: small fix to Makefile to correct #define typo

17 years agocleanup: remove unnecessary macro used in only one place
Erez Zadok [Fri, 18 May 2007 05:56:08 +0000 (01:56 -0400)]
cleanup: remove unnecessary macro used in only one place

Remove the UNIONFS_TMPNAM_LEN macro and just use the actual length of the
string file name in question, which is more efficient (and correct).

17 years agobug fix: don't revalidate dropped dentries
Erez Zadok [Fri, 18 May 2007 05:53:12 +0000 (01:53 -0400)]
bug fix: don't revalidate dropped dentries

This fixes a harmless but annoying message that unionfs prints if a dropped
dentry is being revalidated, which could happen if you unlink open files.

17 years agobug fix: retry lookup for different silly-renamed files
Erez Zadok [Fri, 18 May 2007 05:45:18 +0000 (01:45 -0400)]
bug fix: retry lookup for different silly-renamed files

When we have to copyup an open-but-unlinked file, we have to give it a
temporary name, similar to NFS's silly-renamed files.  So we generate
temporary file names until we find one that doesn't exist, and use it.  The
code had a bug where if the silly-renamed file name already existed, Unionfs
would oops upon copyup to that temp name.

17 years agoDocumentation: better comments for copyup-related code
Erez Zadok [Fri, 18 May 2007 05:41:04 +0000 (01:41 -0400)]
Documentation: better comments for copyup-related code

17 years agoVerify and maintain fanout invariants.
Erez Zadok [Fri, 18 May 2007 05:39:26 +0000 (01:39 -0400)]
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.

17 years agoPost-copyup helper functions
Erez Zadok [Fri, 18 May 2007 05:31:14 +0000 (01:31 -0400)]
Post-copyup helper functions

Two functions which are very useful to execute common actions needed after a
copy-up had taken place.

17 years agoIntroduce compile-time debugging support to Unionfs
Erez Zadok [Fri, 18 May 2007 05:28:00 +0000 (01:28 -0400)]
Introduce compile-time debugging support to Unionfs

Similar to other file systems, to turn on debugging, one is asked to change
the Makefile slightly.  The vast majority of the debugging utility functions
are in debug.c.  They are useful for developers and users to report to
developers.  The main code has some very useful hooks left behind that are
non-intrusive and cleaner (i.e., no "ifdef DEBUG" clutter).

17 years agobugfixes: correctly decrement refcounts of mnt's upon branch management
Erez_Zadok [Fri, 11 May 2007 05:55:19 +0000 (01:55 -0400)]
bugfixes: correctly decrement refcounts of mnt's upon branch management

The old logic was broken in one place, which another place tried to "fix"
incorrectly.  Also added detailed comments to explain the new/correct logic.

17 years agobugfix in BUG_ON use: actually catch bad use of unionfs_mntput
Erez_Zadok [Fri, 11 May 2007 05:51:48 +0000 (01:51 -0400)]
bugfix in BUG_ON use: actually catch bad use of unionfs_mntput