mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-04-06 17:49:11 +03:00
Change default to overlay=on
Filesystems allow overlay mounts by default on FreeBSD and Linux. Respect the native convention by switching the default to overlay=on, while retaining the option to turn the property off for compatibility with other operating systems' conventions. Update documentation and tests accordingly. Reviewed-by: Richard Laager <rlaager@wiktel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10030
This commit is contained in:
parent
788398c562
commit
f5f6fb03b7
@ -474,8 +474,8 @@ zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Overlay mounts are disabled by default but may be enabled
|
* Overlay mounts are enabled by default but may be disabled
|
||||||
* via the 'overlay' property or the 'zfs mount -O' option.
|
* via the 'overlay' property. The -O flag remains for compatibility.
|
||||||
*/
|
*/
|
||||||
if (!(flags & MS_OVERLAY)) {
|
if (!(flags & MS_OVERLAY)) {
|
||||||
if (zfs_prop_get(zhp, ZFS_PROP_OVERLAY, overlay,
|
if (zfs_prop_get(zhp, ZFS_PROP_OVERLAY, overlay,
|
||||||
@ -489,7 +489,7 @@ zfs_mount_at(zfs_handle_t *zhp, const char *options, int flags,
|
|||||||
/*
|
/*
|
||||||
* Determine if the mountpoint is empty. If so, refuse to perform the
|
* Determine if the mountpoint is empty. If so, refuse to perform the
|
||||||
* mount. We don't perform this check if 'remount' is
|
* mount. We don't perform this check if 'remount' is
|
||||||
* specified or if overlay option(-O) is given
|
* specified or if overlay option (-O) is given
|
||||||
*/
|
*/
|
||||||
if ((flags & MS_OVERLAY) == 0 && !remount &&
|
if ((flags & MS_OVERLAY) == 0 && !remount &&
|
||||||
!dir_is_empty(mountpoint)) {
|
!dir_is_empty(mountpoint)) {
|
||||||
|
@ -1157,14 +1157,16 @@ See
|
|||||||
for more information on
|
for more information on
|
||||||
.Sy nbmand
|
.Sy nbmand
|
||||||
mounts. This property is not used on Linux.
|
mounts. This property is not used on Linux.
|
||||||
.It Sy overlay Ns = Ns Sy off Ns | Ns Sy on
|
.It Sy overlay Ns = Ns Sy on Ns | Ns Sy off
|
||||||
Allow mounting on a busy directory or a directory which already contains
|
Allow mounting on a busy directory or a directory which already contains
|
||||||
files or directories. This is the default mount behavior for Linux file systems.
|
files or directories.
|
||||||
For consistency with OpenZFS on other platforms overlay mounts are
|
This is the default mount behavior for Linux and FreeBSD file systems.
|
||||||
.Sy off
|
On these platforms the property is
|
||||||
by default. Set to
|
|
||||||
.Sy on
|
.Sy on
|
||||||
to enable overlay mounts.
|
by default.
|
||||||
|
Set to
|
||||||
|
.Sy off
|
||||||
|
to disable overlay mounts for consistency with OpenZFS on other platforms.
|
||||||
.It Sy primarycache Ns = Ns Sy all Ns | Ns Sy none Ns | Ns Sy metadata
|
.It Sy primarycache Ns = Ns Sy all Ns | Ns Sy none Ns | Ns Sy metadata
|
||||||
Controls what is cached in the primary cache
|
Controls what is cached in the primary cache
|
||||||
.Pq ARC .
|
.Pq ARC .
|
||||||
|
@ -406,7 +406,7 @@ zfs_prop_init(void)
|
|||||||
zprop_register_index(ZFS_PROP_NBMAND, "nbmand", 0, PROP_INHERIT,
|
zprop_register_index(ZFS_PROP_NBMAND, "nbmand", 0, PROP_INHERIT,
|
||||||
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, "on | off", "NBMAND",
|
ZFS_TYPE_FILESYSTEM | ZFS_TYPE_SNAPSHOT, "on | off", "NBMAND",
|
||||||
boolean_table);
|
boolean_table);
|
||||||
zprop_register_index(ZFS_PROP_OVERLAY, "overlay", 0, PROP_INHERIT,
|
zprop_register_index(ZFS_PROP_OVERLAY, "overlay", 1, PROP_INHERIT,
|
||||||
ZFS_TYPE_FILESYSTEM, "on | off", "OVERLAY", boolean_table);
|
ZFS_TYPE_FILESYSTEM, "on | off", "OVERLAY", boolean_table);
|
||||||
|
|
||||||
/* default index properties */
|
/* default index properties */
|
||||||
|
@ -181,7 +181,7 @@ tags = ['functional', 'cli_root', 'zfs_load-key']
|
|||||||
tests = ['zfs_mount_001_pos', 'zfs_mount_002_pos', 'zfs_mount_003_pos',
|
tests = ['zfs_mount_001_pos', 'zfs_mount_002_pos', 'zfs_mount_003_pos',
|
||||||
'zfs_mount_004_pos', 'zfs_mount_005_pos', 'zfs_mount_007_pos',
|
'zfs_mount_004_pos', 'zfs_mount_005_pos', 'zfs_mount_007_pos',
|
||||||
'zfs_mount_009_neg', 'zfs_mount_010_neg', 'zfs_mount_011_neg',
|
'zfs_mount_009_neg', 'zfs_mount_010_neg', 'zfs_mount_011_neg',
|
||||||
'zfs_mount_012_neg', 'zfs_mount_all_001_pos', 'zfs_mount_encrypted',
|
'zfs_mount_012_pos', 'zfs_mount_all_001_pos', 'zfs_mount_encrypted',
|
||||||
'zfs_mount_remount', 'zfs_mount_all_fail', 'zfs_mount_all_mountpoints',
|
'zfs_mount_remount', 'zfs_mount_all_fail', 'zfs_mount_all_mountpoints',
|
||||||
'zfs_mount_test_race']
|
'zfs_mount_test_race']
|
||||||
tags = ['functional', 'cli_root', 'zfs_mount']
|
tags = ['functional', 'cli_root', 'zfs_mount']
|
||||||
|
@ -13,7 +13,7 @@ dist_pkgdata_SCRIPTS = \
|
|||||||
zfs_mount_009_neg.ksh \
|
zfs_mount_009_neg.ksh \
|
||||||
zfs_mount_010_neg.ksh \
|
zfs_mount_010_neg.ksh \
|
||||||
zfs_mount_011_neg.ksh \
|
zfs_mount_011_neg.ksh \
|
||||||
zfs_mount_012_neg.ksh \
|
zfs_mount_012_pos.ksh \
|
||||||
zfs_mount_all_001_pos.ksh \
|
zfs_mount_all_001_pos.ksh \
|
||||||
zfs_mount_all_fail.ksh \
|
zfs_mount_all_fail.ksh \
|
||||||
zfs_mount_all_mountpoints.ksh \
|
zfs_mount_all_mountpoints.ksh \
|
||||||
|
@ -35,22 +35,20 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
# Invoke "zfs mount <filesystem>" with a filesystem
|
# Invoke "zfs mount <filesystem>" with a filesystem mountpoint that is
|
||||||
# mountpoint that is identical to an existing one.
|
# identical to an existing one. It will fail with a return code of 1
|
||||||
# It will fail with a return code of 1. For Linux,
|
# when overlay=off. Place a file in the directory to ensure the failure.
|
||||||
# place a file in the directory to ensure the failure.
|
# Also test overlay=on (default) in which case the mount will not fail.
|
||||||
# Also for Linux, test overlay=off (default) in which case
|
|
||||||
# the mount will fail, and overlay=on, where the mount
|
|
||||||
# will succeed.
|
|
||||||
#
|
#
|
||||||
# STRATEGY:
|
# STRATEGY:
|
||||||
# 1. Prepare an existing mounted filesystem.
|
# 1. Prepare an existing mounted filesystem.
|
||||||
# 2. Setup a new filesystem and make sure that it is unmounted.
|
# 2. Setup a new filesystem with overlay=off and make sure that it is
|
||||||
# 3. For Linux, place a file in the mount point folder.
|
# unmounted.
|
||||||
# 4. Mount the new filesystem using the various combinations
|
# 3. Place a file in the mount point folder.
|
||||||
# - zfs set mountpoint=<identical path> <filesystem>
|
# 4. Mount the new filesystem using the various combinations
|
||||||
# - zfs set mountpoint=<top path> <filesystem>
|
# - zfs set mountpoint=<identical path> <filesystem>
|
||||||
# 5. Verify that mount failed with return code of 1.
|
# - zfs set mountpoint=<top path> <filesystem>
|
||||||
|
# 5. Verify that mount failed with return code of 1.
|
||||||
# 6. For Linux, also set overlay=on and verify the mount is
|
# 6. For Linux, also set overlay=on and verify the mount is
|
||||||
# allowed.
|
# allowed.
|
||||||
#
|
#
|
||||||
@ -76,7 +74,7 @@ typeset -i ret=0
|
|||||||
|
|
||||||
log_assert "Verify that 'zfs $mountcmd <filesystem>'" \
|
log_assert "Verify that 'zfs $mountcmd <filesystem>'" \
|
||||||
"where the mountpoint is identical or on top of an existing one" \
|
"where the mountpoint is identical or on top of an existing one" \
|
||||||
"will fail with return code 1."
|
"will fail with return code 1 when overlay=off."
|
||||||
|
|
||||||
log_onexit cleanup
|
log_onexit cleanup
|
||||||
|
|
||||||
@ -98,8 +96,8 @@ done
|
|||||||
log_must zfs set mountpoint=$mtpt $TESTPOOL/$TESTFS
|
log_must zfs set mountpoint=$mtpt $TESTPOOL/$TESTFS
|
||||||
log_must zfs $mountcmd $TESTPOOL/$TESTFS
|
log_must zfs $mountcmd $TESTPOOL/$TESTFS
|
||||||
|
|
||||||
if is_linux; then
|
log_must zfs set overlay=off $TESTPOOL/$TESTFS
|
||||||
log_must zfs set overlay=off $TESTPOOL/$TESTFS
|
if ! is_illumos; then
|
||||||
touch $mtpt/file.1
|
touch $mtpt/file.1
|
||||||
log_must ls -l $mtpt | grep file
|
log_must ls -l $mtpt | grep file
|
||||||
fi
|
fi
|
||||||
@ -107,7 +105,7 @@ fi
|
|||||||
mounted $TESTPOOL/$TESTFS || \
|
mounted $TESTPOOL/$TESTFS || \
|
||||||
log_unresolved "Filesystem $TESTPOOL/$TESTFS is unmounted"
|
log_unresolved "Filesystem $TESTPOOL/$TESTFS is unmounted"
|
||||||
|
|
||||||
log_must zfs create $TESTPOOL/$TESTFS1
|
log_must zfs create -o overlay=off $TESTPOOL/$TESTFS1
|
||||||
|
|
||||||
unmounted $TESTPOOL/$TESTFS1 || \
|
unmounted $TESTPOOL/$TESTFS1 || \
|
||||||
log_must force_unmount $TESTPOOL/$TESTFS1
|
log_must force_unmount $TESTPOOL/$TESTFS1
|
||||||
@ -123,9 +121,9 @@ while [[ $depth -gt 0 ]] ; do
|
|||||||
|
|
||||||
log_mustnot zfs $mountcmd $TESTPOOL/$TESTFS1
|
log_mustnot zfs $mountcmd $TESTPOOL/$TESTFS1
|
||||||
|
|
||||||
# For Linux, test the overlay=on feature which allows
|
if ! is_illumos; then
|
||||||
# mounting of non-empty directory.
|
# Test the overlay=on feature which allows
|
||||||
if is_linux; then
|
# mounting of non-empty directory.
|
||||||
log_must zfs set overlay=on $TESTPOOL/$TESTFS1
|
log_must zfs set overlay=on $TESTPOOL/$TESTFS1
|
||||||
log_must zfs $mountcmd $TESTPOOL/$TESTFS1
|
log_must zfs $mountcmd $TESTPOOL/$TESTFS1
|
||||||
log_must force_unmount $TESTPOOL/$TESTFS1
|
log_must force_unmount $TESTPOOL/$TESTFS1
|
||||||
|
@ -73,7 +73,8 @@ log_must mkfile 1M $testfile $testfile1
|
|||||||
|
|
||||||
log_must zfs unmount $fs1
|
log_must zfs unmount $fs1
|
||||||
log_must zfs set mountpoint=$mntpnt $fs1
|
log_must zfs set mountpoint=$mntpnt $fs1
|
||||||
log_mustnot zfs mount $fs1
|
log_must zfs mount $fs1
|
||||||
|
log_must zfs unmount $fs1
|
||||||
log_must zfs mount -O $fs1
|
log_must zfs mount -O $fs1
|
||||||
|
|
||||||
# Create new file in override mountpoint
|
# Create new file in override mountpoint
|
||||||
|
@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
#
|
#
|
||||||
# DESCRIPTION:
|
# DESCRIPTION:
|
||||||
# Linux:
|
|
||||||
# Verify that zfs mount fails with a non-empty directory
|
|
||||||
# FreeSD:
|
|
||||||
# Verify that zfs mount succeeds with a non-empty directory
|
# Verify that zfs mount succeeds with a non-empty directory
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -34,18 +31,12 @@
|
|||||||
# 6. Unmount the dataset
|
# 6. Unmount the dataset
|
||||||
# 7. Create a file in the directory created in step 2
|
# 7. Create a file in the directory created in step 2
|
||||||
# 8. Attempt to mount the dataset
|
# 8. Attempt to mount the dataset
|
||||||
# 9. Verify the mount fails
|
# 9. Verify the mount succeeds
|
||||||
#
|
#
|
||||||
|
|
||||||
verify_runnable "both"
|
verify_runnable "both"
|
||||||
|
|
||||||
if is_linux; then
|
log_assert "zfs mount succeeds with non-empty directory"
|
||||||
behaves="fails"
|
|
||||||
else
|
|
||||||
behaves="succeeds"
|
|
||||||
fi
|
|
||||||
|
|
||||||
log_assert "zfs mount $behaves with non-empty directory"
|
|
||||||
|
|
||||||
fs=$TESTPOOL/$TESTFS
|
fs=$TESTPOOL/$TESTFS
|
||||||
|
|
||||||
@ -55,12 +46,8 @@ log_must zfs set mountpoint=$TESTDIR $fs
|
|||||||
log_must zfs mount $fs
|
log_must zfs mount $fs
|
||||||
log_must zfs umount $fs
|
log_must zfs umount $fs
|
||||||
log_must touch $TESTDIR/testfile.$$
|
log_must touch $TESTDIR/testfile.$$
|
||||||
if is_linux; then
|
log_must zfs mount $fs
|
||||||
log_mustnot zfs mount $fs
|
log_must zfs umount $fs
|
||||||
else
|
|
||||||
log_must zfs mount $fs
|
|
||||||
log_must zfs umount $fs
|
|
||||||
fi
|
|
||||||
log_must rm -rf $TESTDIR
|
log_must rm -rf $TESTDIR
|
||||||
|
|
||||||
log_pass "zfs mount $behaves with non-empty directory as expected."
|
log_pass "zfs mount succeeds with non-empty directory as expected."
|
@ -30,8 +30,8 @@
|
|||||||
# 1. Create zfs filesystems
|
# 1. Create zfs filesystems
|
||||||
# 2. Unmount a leaf filesystem
|
# 2. Unmount a leaf filesystem
|
||||||
# 3. Create a file in the above filesystem's mountpoint
|
# 3. Create a file in the above filesystem's mountpoint
|
||||||
# 4. Verify that 'zfs mount -a' fails to mount the above if on Linux
|
# 4. Verify that 'zfs mount -a' succeeds if overlay=on and
|
||||||
# or succeeds if on FreeBSD
|
# fails to mount the above if overlay=off
|
||||||
# 5. Verify that all other filesystems were mounted
|
# 5. Verify that all other filesystems were mounted
|
||||||
#
|
#
|
||||||
|
|
||||||
@ -83,17 +83,18 @@ done
|
|||||||
# Create a stray file in one filesystem's mountpoint
|
# Create a stray file in one filesystem's mountpoint
|
||||||
touch $path/0/strayfile
|
touch $path/0/strayfile
|
||||||
|
|
||||||
# Verify that zfs mount -a fails on Linux or succeeds on FreeBSD
|
|
||||||
export __ZFS_POOL_RESTRICT="$TESTPOOL"
|
export __ZFS_POOL_RESTRICT="$TESTPOOL"
|
||||||
if is_linux; then
|
|
||||||
log_mustnot zfs $mountall
|
# Verify that zfs mount -a succeeds with overlay=on (default)
|
||||||
log_mustnot mounted "$TESTPOOL/0"
|
log_must zfs $mountall
|
||||||
typeset behaved="failed"
|
log_must mounted "$TESTPOOL/0"
|
||||||
else
|
log_must zfs $unmountall
|
||||||
log_must zfs $mountall
|
|
||||||
log_must mounted "$TESTPOOL/0"
|
# Verify that zfs mount -a succeeds with overlay=off
|
||||||
typeset behaved="succeeded"
|
log_must zfs set overlay=off "$TESTPOOL/0"
|
||||||
fi
|
log_mustnot zfs $mountall
|
||||||
|
log_mustnot mounted "$TESTPOOL/0"
|
||||||
|
|
||||||
unset __ZFS_POOL_RESTRICT
|
unset __ZFS_POOL_RESTRICT
|
||||||
|
|
||||||
# All other filesystems should be mounted
|
# All other filesystems should be mounted
|
||||||
@ -101,4 +102,4 @@ for ((i=1; i<$fscount; i++)); do
|
|||||||
log_must mounted "$TESTPOOL/$i"
|
log_must mounted "$TESTPOOL/$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
log_pass "'zfs $mountall' $behaved as expected."
|
log_pass "'zfs $mountall' behaves as expected."
|
||||||
|
Loading…
Reference in New Issue
Block a user