freebsd-skq/libexec/rc/rc.d/zvol
Xin LI 0cd669785d Make zpool on GELI work again.
After OpenZFS import, zpool auto import behavior was moved to an
explicit "zpool import -a", and the zpool rc.d script was added
as a prerequisite of zvol.

However, in r299839, zvol was added as a prerequisite of dumpon,
making it to start very early and before all 'disks' providers.
At this time, dumping on a zvol is not supported, so remove this
requirement and make zpool depend on disks to allow zpool on
full disk encryption work.

Reviewed by:		allanjude
Differential Revision:	https://reviews.freebsd.org/D26333
2020-09-04 23:36:43 +00:00

47 lines
736 B
Bash
Executable File

#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: zvol
# REQUIRE: zpool
# KEYWORD: nojail
. /etc/rc.subr
name="zvol"
desc="Activate swap on ZVOLs"
rcvar="zfs_enable"
start_cmd="zvol_start"
stop_cmd="zvol_stop"
required_modules="zfs"
zvol_start()
{
# Enable swap on ZVOLs with property org.freebsd:swap=on.
zfs list -H -o org.freebsd:swap,name -t volume |
while read state name; do
case "${state}" in
([oO][nN])
swapon /dev/zvol/${name}
;;
esac
done
}
zvol_stop()
{
# Disable swap on ZVOLs with property org.freebsd:swap=on.
zfs list -H -o org.freebsd:swap,name -t volume |
while read state name; do
case "${state}" in
([oO][nN])
swapoff /dev/zvol/${name}
;;
esac
done
}
load_rc_config $name
run_rc_command "$1"