-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for zfs mount -r <filesystem>
This commit adds support for mounting a dataset along with all of it's children with '-r' flag for zfs mount. There can be scenarios where we want to mount all datasets under one hierarchy instead of mounting all datasets present on system with '-a' flag. '-r' flag should work on all root and non-root datasets. Usage information and man page has been updated for zfs mount. A test for verifying the behavior for '-r' flag is also added. Signed-off-by: Umer Saleem <[email protected]>
- Loading branch information
1 parent
8f2f6cd
commit 5d2943f
Showing
7 changed files
with
211 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
141 changes: 141 additions & 0 deletions
141
tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_recursive.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# The contents of this file are subject to the terms of the | ||
# Common Development and Distribution License (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# | ||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
# or https://opensource.org/licenses/CDDL-1.0. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
# When distributing Covered Code, include this CDDL HEADER in each | ||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
# If applicable, add the following below this CDDL HEADER, with the | ||
# fields enclosed by brackets "[]" replaced with your own identifying | ||
# information: Portions Copyright [yyyy] [name of copyright owner] | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright 2024, iXsystems Inc. All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/cli_root/zfs_mount/zfs_mount.kshlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# Verify zfs mount -r <filesystems/s> functionality. | ||
# | ||
# STRATEGY: | ||
# 1. Create nested datasets | ||
# 2. Unmount all datasets | ||
# 3. Recusrive mount root datasets, this should mount all datasets | ||
# present in a pool | ||
# 4. Unmount all datasets | ||
# 5. Recusrsive mount child datasets with children. This should mount | ||
# child datasets, but not the root dataset or parent datasets | ||
# 6. Unmount all datasets | ||
# 7. Mount root ddataset recursively again and confirm all child | ||
# datasets are mounted. | ||
# | ||
|
||
verify_runnable "both" | ||
|
||
function cleanup | ||
{ | ||
log_must poolexists $TESTPOOL && destroy_pool $TESTPOOL | ||
} | ||
|
||
function setup_all | ||
{ | ||
log_must datasetexists $TESTPOOL/$TESTFS || zfs create $TESTPOOL/$TESTFS | ||
log_must zfs create $TESTPOOL/$TESTFS1 | ||
log_must zfs create $TESTPOOL/$TESTFS2 | ||
log_must zfs create $TESTPOOL/$TESTFS3 | ||
log_must zfs create $TESTPOOL/$TESTFS2/child1 | ||
log_must zfs create $TESTPOOL/$TESTFS2/child2 | ||
log_must zfs create $TESTPOOL/$TESTFS2/child3 | ||
log_must zfs create $TESTPOOL/$TESTFS2/child2/subchild | ||
log_must zfs create $TESTPOOL/$TESTFS3/child | ||
} | ||
|
||
log_assert "Verify that 'zfs $mountrecursive' successfully, " \ | ||
"mounts the dataset along with all it's children." | ||
|
||
log_onexit cleanup | ||
|
||
log_must setup_all | ||
|
||
log_must zfs $unmountall | ||
|
||
log_must zfs $mountrecursive $TESTPOOL | ||
|
||
log_must mounted $TESTPOOL | ||
log_must mounted $TESTPOOL/$TESTFS | ||
log_must mounted $TESTPOOL/$TESTFS1 | ||
log_must mounted $TESTPOOL/$TESTFS2 | ||
log_must mounted $TESTPOOL/$TESTFS3 | ||
log_must mounted $TESTPOOL/$TESTFS2/child1 | ||
log_must mounted $TESTPOOL/$TESTFS2/child2 | ||
log_must mounted $TESTPOOL/$TESTFS2/child3 | ||
log_must mounted $TESTPOOL/$TESTFS2/child2/subchild | ||
log_must mounted $TESTPOOL/$TESTFS3/child | ||
|
||
log_must zfs $unmountall | ||
|
||
log_mustnot mounted $TESTPOOL | ||
log_mustnot mounted $TESTPOOL/$TESTFS | ||
log_mustnot mounted $TESTPOOL/$TESTFS1 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2 | ||
log_mustnot mounted $TESTPOOL/$TESTFS3 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child1 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child2 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child3 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child2/subchild | ||
log_mustnot mounted $TESTPOOL/$TESTFS3/child | ||
|
||
log_must zfs $mountrecursive $TESTPOOL/$TESTFS2 $TESTPOOL/$TESTFS3 | ||
|
||
log_mustnot mounted $TESTPOOL | ||
log_mustnot mounted $TESTPOOL/$TESTFS | ||
log_mustnot mounted $TESTPOOL/$TESTFS1 | ||
log_must mounted $TESTPOOL/$TESTFS2 | ||
log_must mounted $TESTPOOL/$TESTFS3 | ||
log_must mounted $TESTPOOL/$TESTFS2/child1 | ||
log_must mounted $TESTPOOL/$TESTFS2/child2 | ||
log_must mounted $TESTPOOL/$TESTFS2/child3 | ||
log_must mounted $TESTPOOL/$TESTFS2/child2/subchild | ||
log_must mounted $TESTPOOL/$TESTFS3/child | ||
|
||
log_must zfs $unmountall | ||
|
||
log_mustnot mounted $TESTPOOL | ||
log_mustnot mounted $TESTPOOL/$TESTFS | ||
log_mustnot mounted $TESTPOOL/$TESTFS1 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2 | ||
log_mustnot mounted $TESTPOOL/$TESTFS3 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child1 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child2 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child3 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child2/subchild | ||
log_mustnot mounted $TESTPOOL/$TESTFS3/child | ||
|
||
log_must zfs $mountrecursive $TESTPOOL/$TESTFS2/child2 | ||
|
||
log_must mounted $TESTPOOL/$TESTFS2/child2 | ||
log_must mounted $TESTPOOL/$TESTFS2/child2/subchild | ||
log_mustnot mounted $TESTPOOL | ||
log_mustnot mounted $TESTPOOL/$TESTFS | ||
log_mustnot mounted $TESTPOOL/$TESTFS1 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2 | ||
log_mustnot mounted $TESTPOOL/$TESTFS3 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child1 | ||
log_mustnot mounted $TESTPOOL/$TESTFS2/child3 | ||
log_mustnot mounted $TESTPOOL/$TESTFS3/child | ||
|
||
log_pass "'zfs $mountrecursive' behaves as expected." |