UBUNTU: SAUCE: overlayfs -- overlay filesystem
authorMiklos Szeredi <mszeredi@suse.cz>
Thu, 4 Aug 2011 11:56:28 +0000 (13:56 +0200)
committerLeann Ogasawara <leann.ogasawara@canonical.com>
Mon, 2 Apr 2012 20:10:01 +0000 (13:10 -0700)
commit2c41b215451bb6d7b5f7033b1c1a2548b5967632
treeba91a83a1f88b69a5ca9b9d8db86a2a3f501d514
parentbc55bd5daafe1d3d14117b6096d4ae868e2ee605
UBUNTU: SAUCE: overlayfs -- overlay filesystem

Overlayfs allows one, usually read-write, directory tree to be
overlaid onto another, read-only directory tree.  All modifications
go to the upper, writable layer.

This type of mechanism is most often used for live CDs but there's a
wide variety of other uses.

The implementation differs from other "union filesystem"
implementations in that after a file is opened all operations go
directly to the underlying, lower or upper, filesystems.  This
simplifies the implementation and allows native performance in these
cases.

The dentry tree is duplicated from the underlying filesystems, this
enables fast cached lookups without adding special support into the
VFS.  This uses slightly more memory than union mounts, but dentries
are relatively small.

Currently inodes are duplicated as well, but it is a possible
optimization to share inodes for non-directories.

Opening non directories results in the open forwarded to the
underlying filesystem.  This makes the behavior very similar to union
mounts (with the same limitations vs. fchmod/fchown on O_RDONLY file
descriptors).

Usage:

  mount -t overlay -olowerdir=/lower,upperdir=/upper overlay /mnt

Supported:

 - all operations

Missing:

 - ensure that filesystems part of the overlay are not modified outside
   the overlay

The following cotributions have been folded into this patch:

Neil Brown <neilb@suse.de>:
 - minimal remount support
 - use correct seek function for directories
 - initialise is_real before use
 - rename ovl_fill_cache to ovl_dir_read

Felix Fietkau <nbd@openwrt.org>:
 - fix a deadlock in ovl_dir_read_merged
 - fix a deadlock in ovl_remove_whiteouts

Erez Zadok <ezk@fsl.cs.sunysb.edu>
 - fix cleanup after WARN_ON

Also thanks to the following people for testing and reporting bugs:

  Jordi Pujol <jordipujolp@gmail.com>
  Andy Whitcroft <apw@canonical.com>
  Michal Suchanek <hramrach@centrum.cz>
  Felix Fietkau <nbd@openwrt.org>
  Erez Zadok <ezk@fsl.cs.sunysb.edu>
  Randy Dunlap <rdunlap@xenotime.net>

Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Signed-off-by: Leann Ogasawara <leann.ogasawara@canonical.com>
fs/Kconfig
fs/Makefile
fs/overlayfs/Kconfig [new file with mode: 0644]
fs/overlayfs/Makefile [new file with mode: 0644]
fs/overlayfs/copy_up.c [new file with mode: 0644]
fs/overlayfs/dir.c [new file with mode: 0644]
fs/overlayfs/inode.c [new file with mode: 0644]
fs/overlayfs/overlayfs.h [new file with mode: 0644]
fs/overlayfs/readdir.c [new file with mode: 0644]
fs/overlayfs/super.c [new file with mode: 0644]