mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
'zfs share -a' should handle 'canmount=noauto'
The 'zfs share -a' currently skips any filesystems which have 'canmount=noauto' set. This behavior is unexpected since the one would expect 'zfs share -a' to share any mounted filesystem that has the 'sharenfs' property already set. This changes the behavior of 'zfs share -a' to allow the sharing of 'canmount=noauto' datasets if they are mounted. Reviewed-by: Matt Ahrens <matt@delphix.com> Reviewed-by: Don Brady <don.brady@delphix.com> Reviewed-by: Prakash Surya <prakash.surya@delphix.com> Signed-off-by: George Wilson <gwilson@delphix.com> External-issue: DLPX-71313 Closes #10688
This commit is contained in:
@@ -41,8 +41,10 @@
|
||||
# STRATEGY:
|
||||
# 1. Setup a pool and create fs, volume, snapshot clone within it.
|
||||
# 2. Set canmount=noauto for each dataset and check the return value
|
||||
# and check if it still can be mounted by mount -a.
|
||||
# and check if it still can be mounted by mount -a or shared by
|
||||
# share -a
|
||||
# 3. mount each dataset(except volume) to see if it can be mounted.
|
||||
# 4. verify that a mounted dataset can be shared by share -a.
|
||||
#
|
||||
|
||||
verify_runnable "both"
|
||||
@@ -100,6 +102,7 @@ log_onexit cleanup
|
||||
|
||||
set -A old_mnt
|
||||
set -A old_canmount
|
||||
set -A old_sharenfs
|
||||
typeset tmpmnt=/tmpmount$$
|
||||
typeset ds
|
||||
|
||||
@@ -113,6 +116,7 @@ while (( i < ${#dataset_pos[*]} )); do
|
||||
ds=${dataset_pos[i]}
|
||||
old_mnt[i]=$(get_prop mountpoint $ds)
|
||||
old_canmount[i]=$(get_prop canmount $ds)
|
||||
old_sharenfs[i]=$(get_prop sharenfs $ds)
|
||||
(( i = i + 1 ))
|
||||
done
|
||||
|
||||
@@ -121,6 +125,7 @@ while (( i < ${#dataset_pos[*]} )) ; do
|
||||
dataset=${dataset_pos[i]}
|
||||
set_n_check_prop "noauto" "canmount" "$dataset"
|
||||
log_must zfs set mountpoint=$tmpmnt $dataset
|
||||
log_must zfs set sharenfs=on $dataset
|
||||
if ismounted $dataset; then
|
||||
zfs unmount -a > /dev/null 2>&1
|
||||
log_must mounted $dataset
|
||||
@@ -128,6 +133,8 @@ while (( i < ${#dataset_pos[*]} )) ; do
|
||||
log_must unmounted $dataset
|
||||
log_must zfs mount -a
|
||||
log_must unmounted $dataset
|
||||
log_must zfs share -a
|
||||
log_mustnot is_exported $tmpmnt
|
||||
else
|
||||
log_must zfs mount -a
|
||||
log_must unmounted $dataset
|
||||
@@ -137,6 +144,10 @@ while (( i < ${#dataset_pos[*]} )) ; do
|
||||
|
||||
log_must zfs mount $dataset
|
||||
log_must mounted $dataset
|
||||
log_must zfs share -a
|
||||
log_must is_exported $tmpmnt
|
||||
|
||||
log_must zfs set sharenfs="${old_sharenfs[i]}" $dataset
|
||||
log_must zfs set canmount="${old_canmount[i]}" $dataset
|
||||
log_must zfs set mountpoint="${old_mnt[i]}" $dataset
|
||||
(( i = i + 1 ))
|
||||
|
||||
Reference in New Issue
Block a user