Release onexit/events with any missed zfsdev_state
authorJorgen Lundman <lundman@lundman.net>
Thu, 13 Aug 2020 22:03:23 +0000 (07:03 +0900)
committerGitHub <noreply@github.com>
Thu, 13 Aug 2020 22:03:23 +0000 (15:03 -0700)
commitfaa296c73c7ccd535c0874d4f7e8f7c4ea43eea6
tree2fb84bfdea8f4f357b66d125d1596748edff0abd
parentf67f5832eca415055e1eaf6cdc100f24ae53487a
Release onexit/events with any missed zfsdev_state

Linux and FreeBSD will most likely never see this issue.
On macOS when kext is unloaded, but zed is still connected, zed
will be issued ENODEV. As the cdevsw is released, the kernel
will not have zfsdev_release() called to release minor/onexit/events,
and it "leaks". This ensures it is cleaned up before unload.

Changed the for loop from zsprev, to zsnext style, for less
code duplication.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
Closes #10700
module/os/freebsd/zfs/kmod_core.c
module/os/linux/zfs/zfs_ioctl_os.c
module/zfs/zfs_ioctl.c