Only load the module if the env var ZFS_AUTOLOAD_MODULE is set to YES
This prevents zpool status loading the ZFS module as a side effect.
PR: 295485
Reported by: Dan Mahoney
Event: BSDcan 2026
Sponsored by: Klara, Inc.
Differential D57657
Make libzfs not autoload the ZFS module Authored by allanjude on Fri, Jun 19, 3:10 AM. Tags None Referenced Files
Details
Diff Detail
Event TimelineComment Actions Do we need to have rc.d/zfs kldload zfs as-needed in case someone's implicitly relying on this and running ZFS strictly for data pools rather than root? I think that would make this a non-event for 98%+ of our users if it wasn't already. Comment Actions It was determined that zpool status and zfs list are not the commands used in the original context. Instead: zpool upgrade -v An upstream change has been proposed: https://github.com/openzfs/zfs/pull/18694/changes/3c971d9b219ac135767802c5c014fdd687dacf5b Because, unlike FreeBSD, the Linux zpool upgrade -v does depends on some kernel module results ( /sys/module/zfs/features.pool ), that part of the proposed change is FreeBSD OS specific and Linux would still load its kernel module. Linux does not use kernel module results for zfs upgrade -v and, so, that part is more general. Comment Actions Need to do more tests to confirm, but it looks like the required_modules="zfs" in rc.d/zpool that it should get taken care of that way |