lkml.org 
[lkml]   [1999]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectunion mount (was Re: Transparent mounts)

For those wondering about implementation specifics of Riley's idea, or
in union mount, BSDi's excellent manpage contains swell info. See below.

If there are any developers not yet convinced that union mount is a good
thing, consider the EXAMPLES section in the man page....
The problems I see with Riley's idea (and this is what he asked for):

It's VERY complicated and difficult to understand (and implement? ack!);
Writes to a file on a read-only layer copy it to the highest writable
layer. Writes to a file on a writable layer either a) modify it in situ,
or b) copy it to the highest writable layer. Files are created on the
highest writable, and deleted a) in situ, or b) on the highest layer.
Ugh. Union mount is just beautiful, by comparison.

What the union_mount man page doesn't say about how we should implement:

Reported free space is the available space on the upper layer. (For a COW
that is too large, should the open() or the write() fail with ENOSPC?)

There can be any number of layers below the top (VFS rocks, that way).

All of it can be done in the VFS, except for deleted-file entries, as Rob
pointed out. (But! check out what's in that directory of yours! type
'strings ~' )

If you think COW of a large file is too bad, then a) consider Pavel's
PODFUK with a #patch extension (Whee!) or b) don't do that. :)

- chad

- -- ObPossibleCopyrightViolation:
#MOUNT_UNION(8) BSD System Manager's Manual MOUNT_UNION(8)
#
#NAME
# mount_union - mount union filesystems
#
#SYNOPSIS
# mount_union [-br] [-o options] directory uniondir
#
#DESCRIPTION
# The mount_union command attaches directory above uniondir in such a way
# that the contents of both directory trees remain visible. By default,
# directory becomes the upper layer and uniondir becomes the lower layer.
#
# Options can be specified as a single letter flag, with an optional value,
# in the standard getopt(3) style. Alternatively, options can be given as
# arguments via the -o flag. The long forms below appear in brackets.
#
# The options are as follows:
#
# -b [below]
# Invert the default position, so that directory becomes the lower
# layer and uniondir becomes the upper layer. However, uniondir
# remains the mount point.
#
# -o Options are specified with a -o flag followed by a comma separat-
# ed string of options. See the mount(8) man page for possible op-
# tions and their meanings.
#
# -r [replace]
# Hide the lower layer completely in the same way as mounting with
# mount_null(8).
#
# To enforce filesystem security, the user mounting the filesystem must be
# superuser or else have write permission on the mounted-on directory.
#
# Filenames are looked up in the upper layer and then in the lower layer.
# If a directory is found in the lower layer, and there is no entry in the
# upper layer, then a shadow directory will be created in the upper layer.
# It will be owned by the user who originally did the union mount, with
# mode ``rwxrwxrwx'' (0777) modified by the umask in effect at that time.
#
# If a file exists in the upper layer then there is no way to access a file
# with the same name in the lower layer. If necessary, a combination of
# loopback and union mounts can be made which will still allow the lower
# files to be accessed by a different pathname.
#
# Except in the case of a directory, access to an object is granted via the
# normal filesystem access checks. For directories, the current user must
# have access to both the upper and lower directories (should they both ex-
# ist).
#
# Requests to create or modify objects in uniondir are passed to the upper
# layer with the exception of a few special cases. An attempt to open for
# writing a file which exists in the lower layer causes a copy of the
# entire file to be made to the upper layer, and then for the upper layer
# copy to be opened. Similarly, an attempt to truncate a lower layer file
# to zero length causes an empty file to be created in the upper layer.
# Any other operation which would ultimately require modification to the
# lower layer fails with EROFS.
#
# The union filesystem manipulates the namespace, rather than individual
# filesystems. The union operation applies recursively down the directory
# tree now rooted at uniondir. Thus any filesystems which are mounted under
# uniondir will take part in the union operation. This differs from the
# union option to mount(8) which only applies the union operation to the
# mount point itself, and then only for lookups.
#
#EXAMPLES
# The commands
#
# mount -t cd9660 -o ro /dev/cd0a /usr/src
# mount -t union -o /var/obj /usr/src
#
# mount the CD-ROM drive /dev/cd0a on /usr/src and then attaches /var/obj
# on top. For most purposes the effect of this is to make the source tree
# appear writable even though it is stored on a CD-ROM.
#
# The command
#
# mount -t union -o -b /sys $HOME/sys
#
# attaches the system source tree below the sys directory in the user's
# home directory. This allows individual users to make private changes to
# the source, and build new kernels, without those changes becoming visible
# to other users. Note that the files in the lower layer remain accessible
# via /sys.
#
#SEE ALSO
# intro(2), mount(2), unmount(2), fstab(5), mount(8), mount_null(8)
#
#BUGS
# Without whiteout support from the filesystem backing the upper layer,
# there is no way that delete and rename operations on lower layer objects
# can be done. EROFS is returned for this kind of operations along with
# any others which would make modifications to the lower layer, such as
# chmod(1).
#
# Running find(1) over a union tree has the side-effect of creating a tree
# of shadow directories in the upper layer.
#
#HISTORY
# The mount_union command first appeared in 4.4BSD.
#
#4.4BSD May 1, 1995 2
#
#
#
- --

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:55    [from the cache]
©2003-2011 Jasper Spaans