mirror_zfs/lib
Brian Behlendorf e3fb781c5f Add kernel module auto-loading
Historically a dynamic misc minor number was registered for the
/dev/zfs device in order to prevent minor number collisions.  This
was fine but it prevented us from being able to use the kernel
module auto-loaded which requires a known reserved value.

Resolve this issue by adding a configure test to find an available
misc minor number which can then be used in MODULE_ALIAS_MISCDEV at
build time.  By adding this alias the zfs kmod is added to the list
of known static-nodes and the systemd-tmpfiles-setup-dev service
will create a /dev/zfs character device at boot time.

This in turn allows us to update the 90-zfs.rules file to make it
aware this is a static node.  The upshot of this is that whenever
a process (zpool, zfs, zed) opens the /dev/zfs the kmods will be
automatic loaded.  This even works for unprivileged users so there
is no longer a need to manually load the modules at boot time.

As an additional bonus the zed now no longer needs to start after
the zfs-import.service since it will trigger the module load.

In the unlikely event the minor number we selected conflicts with
another out of tree unregistered minor number the code falls back
to dynamically allocating it.  In this case the modules again
must be manually loaded.

Note that due to the change in the method of registering the minor
number the zimport.sh test case may incorrectly fail when the
static node for the installed packages is created instead of the
dynamic one.  This issue will only transiently impact zimport.sh
for this single commit when we transition and are mixing and
matching methods.

Reviewed-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
TEST_ZIMPORT_SKIP="yes"
Closes #7287
2019-02-22 09:47:34 -08:00
..
libavl Support parallel build trees (VPATH builds) 2015-07-17 13:42:51 -07:00
libefi Revert "zpool reopen should detect expanded devices" 2018-09-13 10:11:42 -07:00
libicp OpenZFS 4185 - add new cryptographic checksums to ZFS: SHA-512, Skein, Edon-R 2016-10-03 14:51:15 -07:00
libnvpair codebase style improvements for OpenZFS 6459 port 2017-01-22 13:25:40 -08:00
libshare Fedora 28: Fix misc bounds check compiler warnings 2018-07-06 02:46:51 -07:00
libspl Fix kernel unaligned access on sparc64 2018-07-06 02:46:51 -07:00
libunicode Support parallel build trees (VPATH builds) 2015-07-17 13:42:51 -07:00
libuutil Correct cppcheck errors (#6662) 2017-09-20 12:59:21 -07:00
libzfs Add kernel module auto-loading 2019-02-22 09:47:34 -08:00
libzfs_core OpenZFS 7600 - zfs rollback should pass target snapshot to kernel 2017-07-04 15:29:52 -07:00
libzpool Linux 4.18 compat: inode timespec -> timespec64 2018-07-06 02:46:51 -07:00
Makefile.am Illumos Crypto Port module added to enable native encryption in zfs 2016-07-20 10:43:30 -07:00