mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Verify 'zfs destroy' will unshare the dataset
This change adds a new test case to the zfs-test suite to verify that when 'zfs destroy' is used on a shared dataset, the dataset will be unshared after the destroy operation completes. Reviewed by: loli10K <ezomori.nozomu@gmail.com> Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Prakash Surya <prakash.surya@delphix.com> Closes #7941
This commit is contained in:
committed by
Brian Behlendorf
parent
1bf490ba93
commit
54eb2c410e
@@ -1230,6 +1230,34 @@ function datasetnonexists
|
||||
return 0
|
||||
}
|
||||
|
||||
function is_shared_impl
|
||||
{
|
||||
typeset fs=$1
|
||||
typeset mtpt
|
||||
|
||||
if is_linux; then
|
||||
for mtpt in `share | awk '{print $1}'` ; do
|
||||
if [[ $mtpt == $fs ]] ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
fi
|
||||
|
||||
for mtpt in `share | awk '{print $2}'` ; do
|
||||
if [[ $mtpt == $fs ]] ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
typeset stat=$(svcs -H -o STA nfs/server:default)
|
||||
if [[ $stat != "ON" ]]; then
|
||||
log_note "Current nfs/server status: $stat"
|
||||
fi
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
#
|
||||
# Given a mountpoint, or a dataset name, determine if it is shared via NFS.
|
||||
#
|
||||
@@ -1254,27 +1282,7 @@ function is_shared
|
||||
fi
|
||||
fi
|
||||
|
||||
if is_linux; then
|
||||
for mtpt in `share | awk '{print $1}'` ; do
|
||||
if [[ $mtpt == $fs ]] ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
return 1
|
||||
fi
|
||||
|
||||
for mtpt in `share | awk '{print $2}'` ; do
|
||||
if [[ $mtpt == $fs ]] ; then
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
typeset stat=$(svcs -H -o STA nfs/server:default)
|
||||
if [[ $stat != "ON" ]]; then
|
||||
log_note "Current nfs/server status: $stat"
|
||||
fi
|
||||
|
||||
return 1
|
||||
is_shared_impl "$fs"
|
||||
}
|
||||
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user