unionfs-odf.git
17 years agoUnionfs ODF: Fix a lockdep recursive lock warning in exports master
Rachita Kothiyal [Tue, 20 May 2008 04:40:29 +0000 (00:40 -0400)]
Unionfs ODF: Fix a lockdep recursive lock warning in exports

With exports, another layer of locking gets introduced. In rename,
the following is the case:
lock_rename      (nfs_rename)
lock_rename (odf_rename)

Since the locks belong to different file systems, it's not a real issue.
Hence turning lockdep off momentarily is safe here (maybe not the
cleanest solution).

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF: Exports: Handle inodes which have been deleted.
Rachita Kothiyal [Sun, 18 May 2008 08:04:29 +0000 (04:04 -0400)]
Unionfs ODF: Exports: Handle inodes which have been deleted.

Lookup the inode in the ODF, which provides a persistent store of
inode attributes, to identify bad inodes (ie inodes which have been
deleted)

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF: Fix incorrect modes on exported unionfs inodes
Rachita Kothiyal [Sun, 4 May 2008 20:39:55 +0000 (16:39 -0400)]
Unionfs ODF: Fix incorrect modes on exported unionfs inodes

Incorrect modes were assigned to inodes when composing a dentry
from a file handle in unionfs_export_iget().

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF: Fix a lockdep warning on nfsd_readdir of exported unionfs mount
Rachita Kothiyal [Sun, 18 May 2008 07:37:20 +0000 (03:37 -0400)]
Unionfs ODF: Fix a lockdep warning on nfsd_readdir of exported unionfs mount

nfsd_readdir calls vfs_llseek and vfs_readdir. Following is the locking
order seen by lockdep:
vfs_llseek: sb -> dentry -> inode
vfs_readdir: inode -> sb -> dentry
Lockdep reports this as a possible circular locking order bug.

To fix this, we define our own unionfs_file_llseek_locked function,
which is essentially the vfs generic_file_llseek function, but with
the inode locking moved into the caller. This now changes the locking
order in vfs_llseek call to be: inode -> sb -> dentry, and satisfies
lockdep too.

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF: Move around locking order in unionfs_dir_llseek
Rachita Kothiyal [Sun, 18 May 2008 07:35:49 +0000 (03:35 -0400)]
Unionfs ODF: Move around locking order in unionfs_dir_llseek

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF: Check UNIONFS_D before grabbing dentry lock
Rachita Kothiyal [Sun, 18 May 2008 07:28:34 +0000 (03:28 -0400)]
Unionfs ODF: Check UNIONFS_D before grabbing dentry lock

First check if the UNIONFS_D() is non NULL, and only then grab
a lock on the dentry.  Since trying to grab a lock, which is a
member of UNIONFS_D(), doesn't make sense if it is itself NULL

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs: check UNIONFS_D() before unionfs_check_dentry during release
Rachita Kothiyal [Fri, 14 Mar 2008 03:36:31 +0000 (23:36 -0400)]
Unionfs: check UNIONFS_D() before unionfs_check_dentry during release

When we are at the point of releasing a unionfs dentry, check the sanity of
the dentry after we have established that UNIONFS_D() is not NULL.  This
solves a potential race between two threads trying to release the same
dentry.

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF: Move around locking order in unions_readdir()
Rachita Kothiyal [Sun, 18 May 2008 07:19:33 +0000 (03:19 -0400)]
Unionfs ODF: Move around locking order in unions_readdir()

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs: prevent races in unionfs_fault
Rachita Kothiyal [Mon, 7 Apr 2008 15:08:13 +0000 (11:08 -0400)]
Unionfs: prevent races in unionfs_fault

vm_ops->fault may be called in parallel.  Because we have to resort to
temporarily changing the vma->vm_file to point to the lower file, a
concurrent invocation of unionfs_fault could see a different value.  In this
workaround, we keep a different copy of the vma structure in our stack, so
we never expose a different value of the vma->vm_file called to us, even
temporarily.  A better fix would be to change the calling semantics of
->fault to take an explicit file pointer.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs ODF: release 2.3.2
Rachita Kothiyal [Wed, 2 Apr 2008 20:38:18 +0000 (16:38 -0400)]
Unionfs ODF: release 2.3.2

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: update lower mnts on rmdir with copyup
Rachita Kothiyal [Wed, 2 Apr 2008 20:40:09 +0000 (16:40 -0400)]
Unionfs: update lower mnts on rmdir with copyup

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: don't purge lower sb data on remount
Rachita Kothiyal [Wed, 2 Apr 2008 20:40:31 +0000 (16:40 -0400)]
Unionfs: don't purge lower sb data on remount

This is no longer needed, as we don't have upper and lower pages.  Plus this
was racy, requiring the unexported inode_lock variable.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agopatch fixes-to-unionfs-lock-dentry-in-file-ops.patch
Rachita Kothiyal [Wed, 2 Apr 2008 16:26:44 +0000 (12:26 -0400)]
patch fixes-to-unionfs-lock-dentry-in-file-ops.patch

17 years agoUnionfs-odf: release 2.3.1
Rachita Kothiyal [Wed, 2 Apr 2008 16:10:48 +0000 (12:10 -0400)]
Unionfs-odf: release 2.3.1

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: do not over-decrement lower superblock refs on remount
Rachita Kothiyal [Mon, 31 Mar 2008 20:09:25 +0000 (16:09 -0400)]
Unionfs: do not over-decrement lower superblock refs on remount

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs-odf: release 2.3
Rachita Kothiyal [Mon, 31 Mar 2008 20:17:49 +0000 (16:17 -0400)]
Unionfs-odf: release 2.3

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: display mount point name along with generation number
Rachita Kothiyal [Mon, 31 Mar 2008 20:04:37 +0000 (16:04 -0400)]
Unionfs: display mount point name along with generation number

CC: Dave Miller <justdave@mozilla.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: document reasons for opaque directories
Rachita Kothiyal [Mon, 31 Mar 2008 20:01:37 +0000 (16:01 -0400)]
Unionfs: document reasons for opaque directories

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: use __func__ instead of __FUNCTION__
Rachita Kothiyal [Mon, 31 Mar 2008 19:54:52 +0000 (15:54 -0400)]
Unionfs: use __func__ instead of __FUNCTION__

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: don't copy parent inode times in setattr
Rachita Kothiyal [Mon, 31 Mar 2008 19:52:29 +0000 (15:52 -0400)]
Unionfs: don't copy parent inode times in setattr

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: lock our dentry in file operations
Rachita Kothiyal [Mon, 31 Mar 2008 19:49:55 +0000 (15:49 -0400)]
Unionfs: lock our dentry in file operations

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: implement vm_operations->fault
Rachita Kothiyal [Mon, 31 Mar 2008 16:54:52 +0000 (12:54 -0400)]
Unionfs: implement vm_operations->fault

As per recommendations made at LSF'08, a stackable file system which does
not change the data across layers, should try to use vm_operations instead
of address_space_operations.  This means we now have to implement out own
->read and ->write methods because we cannot rely on VFS helpers which
require us to have a ->readpage method.  Either way there are two caveats:

(1) It's not possible currently to set inode->i_mapping->a_ops to NULL,
because too many code paths expect i_mapping to be non-NULL.

(2) a small/dummy ->readpage is still needed because generic_file_mmap,
which we used in unionfs_mmap, still check for the existence of the
->readpage method.  These code paths may have to be changed to remove the
need for readpage().

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: implement splice_read/write methods directly
Rachita Kothiyal [Mon, 31 Mar 2008 16:46:35 +0000 (12:46 -0400)]
Unionfs: implement splice_read/write methods directly

Must implement splice_read/write directly, using VFS helpers, because we can
no longer rely on generic_file_splice_read/write: they need
address_space_operations implemented, which we no longer have.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoVFS: rename do_splice_to/from to vfs_splice_* and export symbols
Rachita Kothiyal [Mon, 31 Mar 2008 16:41:03 +0000 (12:41 -0400)]
VFS: rename do_splice_to/from to vfs_splice_* and export symbols

A stackable file system which uses vm_ops->fault, and does not implement
address_space_operations, cannot use generic_file_splice_read/write, but has
to implement ->splice_read/write itself.  These two helper functions are
very useful to such a module.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoVFS: export release_open_intent as GPL symbol, not regular symbol
Rachita Kothiyal [Mon, 31 Mar 2008 16:35:55 +0000 (12:35 -0400)]
VFS: export release_open_intent as GPL symbol, not regular symbol

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs odf: Fix odf unmount OOPs on export
Rachita Kothiyal [Wed, 19 Mar 2008 20:44:26 +0000 (16:44 -0400)]
Unionfs odf: Fix odf unmount OOPs on export

Fix a leaked reference count on odf_root when trying to connect
disconnected dentries in __get_parent

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs-odf: release 2.2.4
Rachita Kothiyal [Fri, 29 Feb 2008 21:28:52 +0000 (16:28 -0500)]
Unionfs-odf: release 2.2.4

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: use dget_parent in revalidation code
Rachita Kothiyal [Fri, 29 Feb 2008 19:32:13 +0000 (14:32 -0500)]
Unionfs: use dget_parent in revalidation code

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: branch management/configuration fixes
Rachita Kothiyal [Fri, 29 Feb 2008 19:28:04 +0000 (14:28 -0500)]
Unionfs: branch management/configuration fixes

Remove unnecessary calls to update branch m/ctimes, and use them only when
needed.  Update branch vfsmounts after operations that could cause a copyup.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: lock parents' branch configuration fixes
Rachita Kothiyal [Mon, 31 Mar 2008 21:44:48 +0000 (17:44 -0400)]
Unionfs: lock parents' branch configuration fixes

Ensure that we lock the branch configuration of parent and child dentries in
operations which need it, and in the right order.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: factor out revalidation routine
Rachita Kothiyal [Thu, 27 Mar 2008 06:04:11 +0000 (02:04 -0400)]
Unionfs: factor out revalidation routine

To be used by rest of revalidation code, as well a callers who already
locked the child and parent dentry branch-configurations.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: revalidation code cleanup and refactoring
Rachita Kothiyal [Fri, 29 Feb 2008 17:18:19 +0000 (12:18 -0500)]
Unionfs: revalidation code cleanup and refactoring

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: improve debugging in copy_attr_times
Rachita Kothiyal [Fri, 29 Feb 2008 17:03:39 +0000 (12:03 -0500)]
Unionfs: improve debugging in copy_attr_times

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: follow_link locking fixes
Rachita Kothiyal [Fri, 29 Feb 2008 17:01:57 +0000 (12:01 -0500)]
Unionfs: follow_link locking fixes

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: extend dentry branch configuration lock in open
Rachita Kothiyal [Fri, 29 Feb 2008 16:59:31 +0000 (11:59 -0500)]
Unionfs: extend dentry branch configuration lock in open

Dentry branch configuration "info node" lock should extend to calls to
copy_attr_times.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: initialize path_save variable
Rachita Kothiyal [Fri, 29 Feb 2008 16:38:00 +0000 (11:38 -0500)]
Unionfs: initialize path_save variable

This is not strictly necessary, but it helps quiet a gcc-4.2 warning (a good
optimizer may optimize this initialization away).

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
Signed-off-by: Josef 'Jeff' Sipek <jsipek@cs.sunysb.edu>
17 years agoUnionfs: uninline unionfs_copy_attr_times and unionfs_copy_attr_all
Rachita Kothiyal [Fri, 29 Feb 2008 16:31:31 +0000 (11:31 -0500)]
Unionfs: uninline unionfs_copy_attr_times and unionfs_copy_attr_all

This reduces text size by about 6k.

Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: document behavior when the lower topology changes
Rachita Kothiyal [Fri, 29 Feb 2008 15:30:05 +0000 (10:30 -0500)]
Unionfs: document behavior when the lower topology changes

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: ensure consistent lower inodes types
Rachita Kothiyal [Mon, 31 Mar 2008 19:46:51 +0000 (15:46 -0400)]
Unionfs: ensure consistent lower inodes types

When looking up a lower object in multiple branches, especially for
directories, ignore any existing entries whose type is different than the
type of the first found object (otherwise we'll be trying to, say, call
readdir on a non-dir inode).

Signed-off-by: Himanshu Kanda <hkanda@fsl.cs.sunysb.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: grab lower super_block references
Rachita Kothiyal [Fri, 29 Feb 2008 15:25:15 +0000 (10:25 -0500)]
Unionfs: grab lower super_block references

This prevents the lower super_block from being destroyed too early, when a
lower file system is being unmounted with MNT_FORCE or MNT_DETACH.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs-odf: release 2.2.3
Rachita Kothiyal [Fri, 29 Feb 2008 19:36:22 +0000 (14:36 -0500)]
Unionfs-odf: release 2.2.3

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: lock_rename related locking fixes
Rachita Kothiyal [Wed, 26 Mar 2008 21:39:09 +0000 (17:39 -0400)]
Unionfs: lock_rename related locking fixes

CC: Mike Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: d_parent related locking fixes
Rachita Kothiyal [Mon, 25 Feb 2008 00:34:00 +0000 (19:34 -0500)]
Unionfs: d_parent related locking fixes

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs odf: Remove unnecessary function and macro
Rachita Kothiyal [Mon, 25 Feb 2008 00:05:58 +0000 (19:05 -0500)]
Unionfs odf: Remove unnecessary function and macro

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs: remove unnecessary call to d_iput
Rachita Kothiyal [Mon, 25 Feb 2008 00:18:32 +0000 (19:18 -0500)]
Unionfs: remove unnecessary call to d_iput

This old code was to fix a bug which has long since been fixed in our
copyup_permission and unionfs_d_iput.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs ODF: use first writable branch (fix/cleanup)
Rachita Kothiyal [Thu, 27 Mar 2008 05:42:38 +0000 (01:42 -0400)]
Unionfs ODF: use first writable branch (fix/cleanup)

Cleanup code in ->create, ->symlink, and ->mknod: refactor common code into
helper functions.  Also, this allows writing to multiple branches again,
which was broken by an earlier patch.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu
17 years agoMerge branch 'master' of story:/home/git/unionfs-odf
Rachita Kothiyal [Sun, 18 May 2008 07:55:08 +0000 (03:55 -0400)]
Merge branch 'master' of story:/home/git/unionfs-odf

17 years agounionfs: Correction of API kernel_run to kthread_run
Yamini Allu [Mon, 25 Feb 2008 15:19:36 +0000 (10:19 -0500)]
unionfs: Correction of API kernel_run to kthread_run

Signed-off-by: Yamini P. Allu <yamini@fsl.cs.sunysb.edu>
17 years agoRebased to 2.6.24.2
Rachita Kothiyal [Sat, 23 Feb 2008 23:59:47 +0000 (18:59 -0500)]
Rebased to 2.6.24.2

17 years agounionfs: kthread API related Changes
Yamini Allu [Sat, 16 Feb 2008 06:00:32 +0000 (01:00 -0500)]
unionfs: kthread API related Changes

Signed-off-by: Yamini P. Allu <yamini@fsl.cs.sunysb.edu>
17 years agounionfs: Cleaned up code for odf_cleanup
Yamini Allu [Sat, 16 Feb 2008 05:52:19 +0000 (00:52 -0500)]
unionfs: Cleaned up code for odf_cleanup

Signed-off-by: Yamini P. Allu <yamini@fsl.cs.sunysb.edu>
17 years agoAdded a section to usage.txt on configuring ODF partition
Rachita Kothiyal [Thu, 7 Feb 2008 22:45:40 +0000 (17:45 -0500)]
Added a section to usage.txt on configuring ODF partition

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF: Fix configfs related compilation errors
Rachita Kothiyal [Fri, 1 Feb 2008 19:22:11 +0000 (14:22 -0500)]
Unionfs ODF: Fix configfs related compilation errors

Removing unnecessary braces in #define members which confused snprintf
in unionfs_read_help().  Also, fixed the mutex initialization.

Signed-off-by: Rachita Kothiyal <rachita.fsl.cs.sunysb.edu>
17 years agoUnionfs ODF: Rebased to 2.6.24-rc7
Rachita Kothiyal [Fri, 1 Feb 2008 19:26:23 +0000 (14:26 -0500)]
Unionfs ODF: Rebased to 2.6.24-rc7

Signed-off-by: Rachita Kothiyal <rachita.fsl.cs.sunysb.edu>
17 years agoUnionfs-odf: release 2.2.2
Erez Zadok [Thu, 10 Jan 2008 17:43:07 +0000 (12:43 -0500)]
Unionfs-odf: release 2.2.2

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: ensure we have lower dentries in d_iput
Erez Zadok [Thu, 10 Jan 2008 17:14:40 +0000 (12:14 -0500)]
Unionfs: ensure we have lower dentries in d_iput

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: branch-management related locking fixes
Erez Zadok [Thu, 10 Jan 2008 17:13:32 +0000 (12:13 -0500)]
Unionfs: branch-management related locking fixes

Add necessary locking to dentry/inode branch-configuration, so we get
consistent values during branch-management actions.  In d_revalidate_chain,
->permission, and ->create, also lock parent dentry.

17 years agoUnionfs: mmap fixes
Erez Zadok [Thu, 10 Jan 2008 17:11:23 +0000 (12:11 -0500)]
Unionfs: mmap fixes

Ensure we have lower inodes in prepare/commit_write.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: merged several printk KERN_CONT together into one pr_debug
Erez Zadok [Thu, 10 Jan 2008 17:08:10 +0000 (12:08 -0500)]
Unionfs: merged several printk KERN_CONT together into one pr_debug

CC: Joe Perches <joe@perches.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs-odf: release 2.2.1
Erez Zadok [Thu, 10 Jan 2008 17:06:32 +0000 (12:06 -0500)]
Unionfs-odf: release 2.2.1

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: use VFS helpers to manipulate i_nlink
Erez Zadok [Thu, 10 Jan 2008 17:05:17 +0000 (12:05 -0500)]
Unionfs: use VFS helpers to manipulate i_nlink

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: locking fixes
Erez Zadok [Thu, 10 Jan 2008 17:04:26 +0000 (12:04 -0500)]
Unionfs: locking fixes

Lock parent dentries during revalidation.
Reduce total number of lockdep classes used.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: use printk KERN_CONT for debugging messages
Erez Zadok [Thu, 10 Jan 2008 17:03:43 +0000 (12:03 -0500)]
Unionfs: use printk KERN_CONT for debugging messages

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs-odf: release 2.2
Erez Zadok [Thu, 10 Jan 2008 17:02:30 +0000 (12:02 -0500)]
Unionfs-odf: release 2.2

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: don't check parent dentries
Erez Zadok [Thu, 10 Jan 2008 12:13:01 +0000 (07:13 -0500)]
Unionfs: don't check parent dentries

Parent dentries may not be locked and may change, so don't check them.  But
do check parent inodes if they are passed to the method.  Also, ensure the
checks are done only if no error occurred.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: cleanup lower inodes after successful unlink
Erez Zadok [Thu, 10 Jan 2008 12:12:09 +0000 (07:12 -0500)]
Unionfs: cleanup lower inodes after successful unlink

17 years agoUnionfs: minor code rearrangement in rename
Erez Zadok [Thu, 10 Jan 2008 12:11:04 +0000 (07:11 -0500)]
Unionfs: minor code rearrangement in rename

To avoid too much code nesting.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: implement lockdep classes
Erez Zadok [Thu, 10 Jan 2008 12:10:25 +0000 (07:10 -0500)]
Unionfs: implement lockdep classes

Lockdep fixes.  Support locking order/classes (e.g., parent -> child ->
whiteout).  Remove locking from create_parents: it's enough to just dget the
dentries in question.  Move parent locking to from lookup_backend to caller,
unionfs_lookup.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: prevent false lockdep warnings in stacking
Erez Zadok [Thu, 10 Jan 2008 12:09:27 +0000 (07:09 -0500)]
Unionfs: prevent false lockdep warnings in stacking

A stackable file system like unionfs often performs an operation on a lower
file system, by calling a vfs_* method, having been called possibly by the
very same method from the VFS.  Both calls to the vfs_* method grab a lock
in the same lock class, and hence lockdep complains.  This warning is a
false positive in instances where unionfs only calls the vfs_* method on
lower objects; there's a strict lock ordering here: upper objects first,
then lower objects.

We want to prevent these false positives so that lockdep will not shutdown
so it'd still be able to warn us about potentially true locking problems.
So, we temporarily turn off lockdep ONLY AROUND the calls to vfs methods to
which we pass lower objects, and only for those instances where lockdep
complained.  While this solution may seem unclean, it is not without
precedent: other places in the kernel also do similar temporary disabling,
of course after carefully having checked that it is the right thing to do.

In the long run, lockdep needs to be taught how to handle about stacking.
Then this patch can be removed.  It is likely that such lockdep-stacking
support will do essentially the same as this patch: consider the same
ordering (upper then lower) and consider upper vs. lower locks to be in
different classes.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: implement d_iput method
Erez Zadok [Thu, 10 Jan 2008 12:08:18 +0000 (07:08 -0500)]
Unionfs: implement d_iput method

This is needed to drop lower objects early enough, under certain conditions,
so the lower objects don't stay behind until umount(). [LTP testing]

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: don't check dentry on error
Erez Zadok [Thu, 10 Jan 2008 12:07:33 +0000 (07:07 -0500)]
Unionfs: don't check dentry on error

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: initialize namelist variable in rename
Erez Zadok [Thu, 10 Jan 2008 12:06:35 +0000 (07:06 -0500)]
Unionfs: initialize namelist variable in rename

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoRemove unnecessary locking of sb in check_empty and odf_cache_dir
Rachita Kothiyal [Thu, 10 Jan 2008 12:05:55 +0000 (07:05 -0500)]
Remove unnecessary locking of sb in check_empty and odf_cache_dir

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs: minor cleanup in check_empty
Erez Zadok [Thu, 10 Jan 2008 12:05:11 +0000 (07:05 -0500)]
Unionfs: minor cleanup in check_empty

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: update inode times after a successful open
Erez Zadok [Thu, 10 Jan 2008 12:04:18 +0000 (07:04 -0500)]
Unionfs: update inode times after a successful open

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: set our superblock a/m/ctime granularity
Erez Zadok [Thu, 10 Jan 2008 12:03:42 +0000 (07:03 -0500)]
Unionfs: set our superblock a/m/ctime granularity

Set it to 1 ns, because we could be stacked on top of file systems with such
granularity.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: handle on lower inodes in lookup
Erez Zadok [Thu, 10 Jan 2008 12:02:38 +0000 (07:02 -0500)]
Unionfs: handle on lower inodes in lookup

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: remove unnecessary parent lock in create
Erez Zadok [Thu, 10 Jan 2008 12:01:48 +0000 (07:01 -0500)]
Unionfs: remove unnecessary parent lock in create

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: remove unnecessary locking in follow-link
Erez Zadok [Thu, 10 Jan 2008 12:01:01 +0000 (07:01 -0500)]
Unionfs: remove unnecessary locking in follow-link

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: remove unnecessary lock in read_inode
Erez Zadok [Thu, 10 Jan 2008 11:59:57 +0000 (06:59 -0500)]
Unionfs: remove unnecessary lock in read_inode

Our read_inode doesn't need to grab the superblock rwsem because there no
chance it could be affected by branch management.  But our read_inode was
called from other places which did grab need to grab that rwsem, and lockdep
complained.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: remove unnecessary conditional inode lock
Erez Zadok [Thu, 10 Jan 2008 11:59:15 +0000 (06:59 -0500)]
Unionfs: remove unnecessary conditional inode lock

This was intended to protect the inode during branch management, but that is
now done through our superblock rwsem.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: prevent deadlock in cache coherency
Erez Zadok [Thu, 10 Jan 2008 11:58:19 +0000 (06:58 -0500)]
Unionfs: prevent deadlock in cache coherency

Don't try to truncate_inode_pages in in purge_inode_data, because this could
lead to a deadlock between some of address_space ops and dentry
revalidation: the address space op is invoked with a lock on our own page,
and truncate_inode_pages will block on locked pages.  Instead, it should be
enough to be gentler and just invalidate_mapping_pages.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: remove custom read/write methods
Erez Zadok [Thu, 10 Jan 2008 11:57:30 +0000 (06:57 -0500)]
Unionfs: remove custom read/write methods

Having them results in lockdep warnings about having locks and grabbing the
same class locks in do_sync_read/write which were called from
unionfs_read/write.  All they did was revalidate out file object sooner,
which will now be deferred till a bit later.  Instead, use generic
do_sync_read and do_sync_write.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: restructure unionfs_setattr and fix truncation order
Hugh Dickins [Thu, 10 Jan 2008 11:56:50 +0000 (06:56 -0500)]
Unionfs: restructure unionfs_setattr and fix truncation order

Restructure the code to move the lower notify_change out of the loop in
unionfs_setattr.  Cleanup and simplify the code.  Then fix the truncation
order which fsx-linux in a unionfs on tmpfs found.  Then handle copyup
properly.

When shrinking a file, unionfs_setattr needs to vmtruncate the upper level
before notifying change to the lower level, to eliminate those dirty pages
beyond new eof which otherwise drift down to the lower level's writepage,
writing beyond its eof (and later uncovered when the file is expanded).

Also truncate the upper level first when expanding, in the case when
the upper level's s_maxbytes is more limiting than the lower level's.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: mmap fixes
Hugh Dickins [Thu, 10 Jan 2008 11:55:57 +0000 (06:55 -0500)]
Unionfs: mmap fixes

Remove !mapping_cap_writeback_dirty shortcircuit from unionfs_writepages.

It was introduced to avoid the stray AOP_WRITEPAGE_ACTIVATE coming from
shmem_writepage; but that has since been fixed in shmem_writepage and in
write_cache_pages.  It stayed because it looked like a good optimization,
not to waste time calling down to tmpfs when that would serve no purpose.

But in fact this optimization causes hangs when running LTP with unionfs
over tmpfs.  The problem is that the test comes at the wrong level: unionfs
has already declared in its default_backing_dev_info that it's playing by
cap_writeback_dirty rules.  If it does nothing here in its writepages, its
dirty pages accumulate and choke the system.  What's needed is to carry on
down and let its pages be cleaned while in turn they dirty the lower level.

And this now has an additional benefit for tmpfs, that a sync or pdflush
pushes these pages down to shmem_writepage, letting it match the filepage
coming from unionfs with the swap which may have been allocated earlier,
so it can free the duplication sooner than waiting for further pressure.

Remove unnecessary locking/code from prepare_write.  Handle if no lower
inodes in writepage.

Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: release special files on copyup
Erez Zadok [Thu, 10 Jan 2008 11:55:01 +0000 (06:55 -0500)]
Unionfs: release special files on copyup

If we copyup a special file (char, block, etc.), then dput the source
object.

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: initialize inode times for reused inodes
Erez Zadok [Thu, 10 Jan 2008 11:54:22 +0000 (06:54 -0500)]
Unionfs: initialize inode times for reused inodes

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: interpose cleanup and fix for spliced dentries
Erez Zadok [Thu, 10 Jan 2008 11:53:30 +0000 (06:53 -0500)]
Unionfs: interpose cleanup and fix for spliced dentries

Fix unionfs_interpose to fill lower inode info when d_splice_alias returns
NULL.  Also cleanup impossible case (d_splice_alias doesn't return ERR_PTR).

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: clarify usage.txt read/write behavior
Erez Zadok [Thu, 10 Jan 2008 11:52:20 +0000 (06:52 -0500)]
Unionfs: clarify usage.txt read/write behavior

CC: Michael Tokarev <mjt@tls.msk.ru>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: use locking around i_size_write in 32-bit systems
Erez Zadok [Thu, 10 Jan 2008 11:51:29 +0000 (06:51 -0500)]
Unionfs: use locking around i_size_write in 32-bit systems

CC: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoVFS/fs_stack: use locking around i_size_write in 32-bit systems
Hugh Dickins [Thu, 10 Jan 2008 11:50:49 +0000 (06:50 -0500)]
VFS/fs_stack: use locking around i_size_write in 32-bit systems

LTP's iogen01 doio tests hang nicely on 32-bit SMP when /tmp is a unionfs
mount of a tmpfs.  See the comment on i_size_write in linux/fs.h: it needs
to be locked, otherwise i_size_read can spin forever waiting for a lost
seqcount update.

Most filesystems are already holding i_mutex for this, but unionfs calls
fsstack_copy_inode_size from many places, not necessarily holding i_mutex.
Use the low-level i_lock within fsstack_copy_inode_size when 32-bit SMP.

Checked the entire unionfs code to ensure this is the right fix for
i_size_write().

Also compared to what other file systems do when they have to handle inodes,
esp. not their own inodes (e.g., network file systems have to access the
exported file system's inodes).  Found out that most such file systems not just
don't lock around i_size_write, but they don't even use i_size_read or
i_size_write to access the inode's size.

CC: Mike Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoVFS/fs_stack: drop cast on inode passed to i_size_read
Erez Zadok [Thu, 10 Jan 2008 11:49:42 +0000 (06:49 -0500)]
VFS/fs_stack: drop cast on inode passed to i_size_read

i_size_read() takes 'const struct inode *' already, as of 2.6.20.

CC: Mike Halcrow <mhalcrow@us.ibm.com>
Signed-off-by: Jan Engelhardt <jengelh@computergmbh.de>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs ODF2: Fix compilation warnings from exports patch
Rachita Kothiyal [Wed, 19 Dec 2007 04:11:42 +0000 (23:11 -0500)]
Unionfs ODF2: Fix compilation warnings from exports patch

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF2: Documenting the export operations for Unionfs
Rachita Kothiyal [Sun, 16 Dec 2007 18:13:21 +0000 (13:13 -0500)]
Unionfs ODF2: Documenting the export operations for Unionfs

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF2: unionfs_interpose fixup
Rachita Kothiyal [Sun, 16 Dec 2007 08:11:01 +0000 (03:11 -0500)]
Unionfs ODF2: unionfs_interpose fixup

Fix unionfs_interpose to fill lower inode info when d_splice_alias
returns NULL

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs ODF2: Fixes to make unionfs exportable
Rachita Kothiyal [Sun, 16 Dec 2007 08:08:41 +0000 (03:08 -0500)]
Unionfs ODF2: Fixes to make unionfs exportable

Signed-off-by: Rachita Kothiyal <rachita@fsl.cs.sunysb.edu>
17 years agoUnionfs: clarify usage.txt mount options
Erez Zadok [Thu, 13 Dec 2007 22:17:49 +0000 (17:17 -0500)]
Unionfs: clarify usage.txt mount options

CC: Jim Kissel <jlk@osml.eu>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: avoid using drop_pagecache_sb in remount
Erez Zadok [Thu, 13 Dec 2007 15:51:15 +0000 (10:51 -0500)]
Unionfs: avoid using drop_pagecache_sb in remount

Exporting drop_pagecache_sb to modules is somewhat risky because one cannot
sleep inside invalidate_mapping_pages.  This could cause a lot of latency in
the pre-emption code.  So don't export this symbol to minimize the risk that
others will use it.

Instead, unionfs will try to directly invalidate as many pages it can from
the unionfs_remount code.  Invalidating those inode pages is not strictly
required, but helpful in encouraging a revalidation of inodes sooner than
waiting for individual f/s ops to access the union.  Since a remount is
already an expensive but rare operation, this inode pages invalidation
shouldn't add too much overhead.

CC: Nick Piggin <nickpiggin@yahoo.com.au>
Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs ODF: release 2.1.11
Erez Zadok [Sat, 8 Dec 2007 18:47:40 +0000 (13:47 -0500)]
Unionfs ODF: release 2.1.11

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>
17 years agoUnionfs: reduce the amount of cache-coherency debugging messages
Erez Zadok [Sat, 8 Dec 2007 18:45:55 +0000 (13:45 -0500)]
Unionfs: reduce the amount of cache-coherency debugging messages

Signed-off-by: Erez Zadok <ezk@cs.sunysb.edu>