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:
Prakash Surya
2018-09-21 10:54:49 -07:00
committed by Brian Behlendorf
parent 1bf490ba93
commit 54eb2c410e
4 changed files with 105 additions and 23 deletions
+29 -21
View File
@@ -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"
}
#