2019-05-19 12:07:45 +00:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-only
|
2014-11-20 15:39:59 +00:00
|
|
|
config OVERLAY_FS
|
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 overlayfs overlayfs -olowerdir=/lower,upperdir=/upper/upper,workdir=/upper/work /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
Sedat Dilek <sedat.dilek@googlemail.com>
- fix up permission to confirm to new API
Robin Dong <hao.bigrat@gmail.com>
- fix possible leak in ovl_new_inode
- create new inode in ovl_link
Andy Whitcroft <apw@canonical.com>
- switch to __inode_permission()
- copy up i_uid/i_gid from the underlying inode
AV:
- ovl_copy_up_locked() - dput(ERR_PTR(...)) on two failure exits
- ovl_clear_empty() - one failure exit forgetting to do unlock_rename(),
lack of check for udir being the parent of upper, dropping and regaining
the lock on udir (which would require _another_ check for parent being
right).
- bogus d_drop() in copyup and rename [fix from your mail]
- copyup/remove and copyup/rename races [fix from your mail]
- ovl_dir_fsync() leaving ERR_PTR() in ->realfile
- ovl_entry_free() is pointless - it's just a kfree_rcu()
- fold ovl_do_lookup() into ovl_lookup()
- manually assigning ->d_op is wrong. Just use ->s_d_op.
[patches picked from Miklos]:
* copyup/remove and copyup/rename races
* bogus d_drop() in copyup and rename
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>
2014-10-23 22:14:38 +00:00
|
|
|
tristate "Overlay filesystem support"
|
2023-10-02 14:19:46 +00:00
|
|
|
select FS_STACK
|
2017-05-11 11:34:29 +00:00
|
|
|
select EXPORTFS
|
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 overlayfs overlayfs -olowerdir=/lower,upperdir=/upper/upper,workdir=/upper/work /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
Sedat Dilek <sedat.dilek@googlemail.com>
- fix up permission to confirm to new API
Robin Dong <hao.bigrat@gmail.com>
- fix possible leak in ovl_new_inode
- create new inode in ovl_link
Andy Whitcroft <apw@canonical.com>
- switch to __inode_permission()
- copy up i_uid/i_gid from the underlying inode
AV:
- ovl_copy_up_locked() - dput(ERR_PTR(...)) on two failure exits
- ovl_clear_empty() - one failure exit forgetting to do unlock_rename(),
lack of check for udir being the parent of upper, dropping and regaining
the lock on udir (which would require _another_ check for parent being
right).
- bogus d_drop() in copyup and rename [fix from your mail]
- copyup/remove and copyup/rename races [fix from your mail]
- ovl_dir_fsync() leaving ERR_PTR() in ->realfile
- ovl_entry_free() is pointless - it's just a kfree_rcu()
- fold ovl_do_lookup() into ovl_lookup()
- manually assigning ->d_op is wrong. Just use ->s_d_op.
[patches picked from Miklos]:
* copyup/remove and copyup/rename races
* bogus d_drop() in copyup and rename
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>
2014-10-23 22:14:38 +00:00
|
|
|
help
|
|
|
|
An overlay filesystem combines two filesystems - an 'upper' filesystem
|
|
|
|
and a 'lower' filesystem. When a name exists in both filesystems, the
|
|
|
|
object in the 'upper' filesystem is visible while the object in the
|
|
|
|
'lower' filesystem is either hidden or, in the case of directories,
|
|
|
|
merged with the 'upper' object.
|
|
|
|
|
2020-04-14 16:48:35 +00:00
|
|
|
For more information see Documentation/filesystems/overlayfs.rst
|
2016-12-16 10:02:57 +00:00
|
|
|
|
|
|
|
config OVERLAY_FS_REDIRECT_DIR
|
2018-05-31 09:06:10 +00:00
|
|
|
bool "Overlayfs: turn on redirect directory feature by default"
|
2016-12-16 10:02:57 +00:00
|
|
|
depends on OVERLAY_FS
|
|
|
|
help
|
|
|
|
If this config option is enabled then overlay filesystems will use
|
|
|
|
redirects when renaming directories by default. In this case it is
|
|
|
|
still possible to turn off redirects globally with the
|
|
|
|
"redirect_dir=off" module option or on a filesystem instance basis
|
|
|
|
with the "redirect_dir=off" mount option.
|
|
|
|
|
|
|
|
Note, that redirects are not backward compatible. That is, mounting
|
|
|
|
an overlay which has redirects on a kernel that doesn't support this
|
|
|
|
feature will have unexpected results.
|
2017-06-21 12:28:36 +00:00
|
|
|
|
2018-03-07 10:47:15 +00:00
|
|
|
If unsure, say N.
|
|
|
|
|
2017-12-11 10:28:10 +00:00
|
|
|
config OVERLAY_FS_REDIRECT_ALWAYS_FOLLOW
|
|
|
|
bool "Overlayfs: follow redirects even if redirects are turned off"
|
|
|
|
default y
|
|
|
|
depends on OVERLAY_FS
|
|
|
|
help
|
|
|
|
Disable this to get a possibly more secure configuration, but that
|
|
|
|
might not be backward compatible with previous kernels.
|
|
|
|
|
2018-03-07 10:47:15 +00:00
|
|
|
If backward compatibility is not an issue, then it is safe and
|
|
|
|
recommended to say N here.
|
|
|
|
|
2020-04-14 16:48:35 +00:00
|
|
|
For more information, see Documentation/filesystems/overlayfs.rst
|
2017-12-11 10:28:10 +00:00
|
|
|
|
2018-03-07 10:47:15 +00:00
|
|
|
If unsure, say Y.
|
|
|
|
|
2017-06-21 12:28:36 +00:00
|
|
|
config OVERLAY_FS_INDEX
|
|
|
|
bool "Overlayfs: turn on inodes index feature by default"
|
|
|
|
depends on OVERLAY_FS
|
|
|
|
help
|
|
|
|
If this config option is enabled then overlay filesystems will use
|
2018-05-31 09:06:10 +00:00
|
|
|
the index directory to map lower inodes to upper inodes by default.
|
2017-06-21 12:28:36 +00:00
|
|
|
In this case it is still possible to turn off index globally with the
|
|
|
|
"index=off" module option or on a filesystem instance basis with the
|
|
|
|
"index=off" mount option.
|
|
|
|
|
|
|
|
The inodes index feature prevents breaking of lower hardlinks on copy
|
|
|
|
up.
|
|
|
|
|
2018-01-10 21:15:21 +00:00
|
|
|
Note, that the inodes index feature is not backward compatible.
|
|
|
|
That is, mounting an overlay which has an inodes index on a kernel
|
|
|
|
that doesn't support this feature will have unexpected results.
|
2018-01-19 09:26:53 +00:00
|
|
|
|
2018-03-07 10:47:15 +00:00
|
|
|
If unsure, say N.
|
|
|
|
|
2018-01-19 09:26:53 +00:00
|
|
|
config OVERLAY_FS_NFS_EXPORT
|
|
|
|
bool "Overlayfs: turn on NFS export feature by default"
|
|
|
|
depends on OVERLAY_FS
|
|
|
|
depends on OVERLAY_FS_INDEX
|
2018-05-11 15:49:27 +00:00
|
|
|
depends on !OVERLAY_FS_METACOPY
|
2018-01-19 09:26:53 +00:00
|
|
|
help
|
|
|
|
If this config option is enabled then overlay filesystems will use
|
2018-05-31 09:06:10 +00:00
|
|
|
the index directory to decode overlay NFS file handles by default.
|
2018-01-19 09:26:53 +00:00
|
|
|
In this case, it is still possible to turn off NFS export support
|
|
|
|
globally with the "nfs_export=off" module option or on a filesystem
|
|
|
|
instance basis with the "nfs_export=off" mount option.
|
|
|
|
|
|
|
|
The NFS export feature creates an index on copy up of every file and
|
|
|
|
directory. This full index is used to detect overlay filesystems
|
|
|
|
inconsistencies on lookup, like redirect from multiple upper dirs to
|
|
|
|
the same lower dir. The full index may incur some overhead on mount
|
|
|
|
time, especially when verifying that directory file handles are not
|
|
|
|
stale.
|
|
|
|
|
|
|
|
Note, that the NFS export feature is not backward compatible.
|
|
|
|
That is, mounting an overlay which has a full index on a kernel
|
|
|
|
that doesn't support this feature will have unexpected results.
|
2018-03-07 10:47:15 +00:00
|
|
|
|
|
|
|
Most users should say N here and enable this feature on a case-by-
|
|
|
|
case basis with the "nfs_export=on" mount option.
|
|
|
|
|
|
|
|
Say N unless you fully understand the consequences.
|
2018-03-29 06:08:18 +00:00
|
|
|
|
|
|
|
config OVERLAY_FS_XINO_AUTO
|
|
|
|
bool "Overlayfs: auto enable inode number mapping"
|
|
|
|
default n
|
|
|
|
depends on OVERLAY_FS
|
2020-02-21 14:34:42 +00:00
|
|
|
depends on 64BIT
|
2018-03-29 06:08:18 +00:00
|
|
|
help
|
|
|
|
If this config option is enabled then overlay filesystems will use
|
2022-10-07 20:40:54 +00:00
|
|
|
unused high bits in underlying filesystem inode numbers to map all
|
2018-03-29 06:08:18 +00:00
|
|
|
inodes to a unified address space. The mapped 64bit inode numbers
|
|
|
|
might not be compatible with applications that expect 32bit inodes.
|
|
|
|
|
|
|
|
If compatibility with applications that expect 32bit inodes is not an
|
|
|
|
issue, then it is safe and recommended to say Y here.
|
|
|
|
|
2020-04-14 16:48:35 +00:00
|
|
|
For more information, see Documentation/filesystems/overlayfs.rst
|
2018-03-29 06:08:18 +00:00
|
|
|
|
|
|
|
If unsure, say N.
|
2018-05-11 15:49:27 +00:00
|
|
|
|
|
|
|
config OVERLAY_FS_METACOPY
|
|
|
|
bool "Overlayfs: turn on metadata only copy up feature by default"
|
|
|
|
depends on OVERLAY_FS
|
|
|
|
select OVERLAY_FS_REDIRECT_DIR
|
|
|
|
help
|
|
|
|
If this config option is enabled then overlay filesystems will
|
|
|
|
copy up only metadata where appropriate and data copy up will
|
|
|
|
happen when a file is opened for WRITE operation. It is still
|
|
|
|
possible to turn off this feature globally with the "metacopy=off"
|
|
|
|
module option or on a filesystem instance basis with the
|
|
|
|
"metacopy=off" mount option.
|
|
|
|
|
|
|
|
Note, that this feature is not backward compatible. That is,
|
|
|
|
mounting an overlay which has metacopy only inodes on a kernel
|
|
|
|
that doesn't support this feature will have unexpected results.
|
|
|
|
|
|
|
|
If unsure, say N.
|
2023-05-21 08:28:11 +00:00
|
|
|
|
|
|
|
config OVERLAY_FS_DEBUG
|
|
|
|
bool "Overlayfs: turn on extra debugging checks"
|
|
|
|
default n
|
|
|
|
depends on OVERLAY_FS
|
|
|
|
help
|
|
|
|
Say Y here to enable extra debugging checks in overlayfs.
|
|
|
|
|
|
|
|
If unsure, say N.
|