e5912dcf20
The problem is that zfs is asked to stop too early in the shutdown sequence. Other services, such as syslog may still be running and have some files open (e.g., under /var/log). This of course causes the messages like: cannot unmount '/var/run': umount failed cannot unmount '/var/log': umount failed cannot unmount '/var': umount failed cannot unmount '/usr/home': umount failed cannot unmount '/usr': umount failed cannot unmount '/': umount failed For now, let's remove the shutdown KEYWORD from the zfs service, as people are reporting problems in their setups: https://lists.freebsd.org/pipermail/freebsd-current/2020-November/077559.html In the future, we may think of stopping zfs on shutdown after all the other services and just before init(8) exits. Another interesting option might be to a new rcorder(8) KEYWORD like "shutdownjail", but this idea would need to be discussed a bit. Reported by: Johan Hendriks <joh.hendriks gmail.com> Reported by: Yasuhiro KIMURA <yasu utahime.org> Reported by: Tomoaki AOKI <junchoon dec.sakura.ne.jp> Approved by: kevans (src) MFC: 3 days Differential Revision: https://reviews.freebsd.org/D27263
68 lines
872 B
Bash
Executable File
68 lines
872 B
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# PROVIDE: zfs
|
|
# REQUIRE: zfsbe
|
|
# BEFORE: FILESYSTEMS var
|
|
|
|
. /etc/rc.subr
|
|
|
|
name="zfs"
|
|
desc="Mount and share ZFS datasets"
|
|
rcvar="zfs_enable"
|
|
start_cmd="zfs_start"
|
|
stop_cmd="zfs_stop"
|
|
required_modules="zfs"
|
|
|
|
zfs_start_jail()
|
|
{
|
|
if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
|
|
zfs mount -a
|
|
fi
|
|
}
|
|
|
|
zfs_start_main()
|
|
{
|
|
zfs mount -va
|
|
zfs share -a
|
|
if [ ! -r /etc/zfs/exports ]; then
|
|
touch /etc/zfs/exports
|
|
fi
|
|
}
|
|
|
|
zfs_start()
|
|
{
|
|
if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
|
|
zfs_start_jail
|
|
else
|
|
zfs_start_main
|
|
fi
|
|
}
|
|
|
|
zfs_stop_jail()
|
|
{
|
|
if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
|
|
zfs unmount -a
|
|
fi
|
|
}
|
|
|
|
zfs_stop_main()
|
|
{
|
|
zfs unshare -a
|
|
zfs unmount -a
|
|
}
|
|
|
|
zfs_stop()
|
|
{
|
|
if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
|
|
zfs_stop_jail
|
|
else
|
|
zfs_stop_main
|
|
fi
|
|
}
|
|
|
|
load_rc_config $name
|
|
run_rc_command "$1"
|