mirror_zfs/zfs-script-config.sh.in
Brian Behlendorf cf47fad67d Unconditionally load core kernel modules
Loading and unloading the zlib modules as part of the zfs.sh
script has proven a little problematic for a few reasons.

  * First, your kernel may not need to load either zlib_inflate
    or zlib_deflate.  This functionality may be built directly in
    to your kernel.  It depends entirely on what your distribution
    decided was the right thing to do.

  * Second, even if you do manage to load the correct modules you
    may not be able to unload them.  There may other consumers
    of the modules with a reference preventing the unload.

To avoid both of these issues the test scripts have been updated to
attempt to unconditionally load all modules listed in KERNEL_MODULES.
If the module is successfully loaded you must have needed it. If
the module can't be loaded that almost certainly means either it is
built in to your kernel or is already being used by another consumer.
In both cases this is not an issue and we can move on to the spl/zfs
modules.

Finally, by removing these kernel modules from the MODULES list
we ensure they are never unloaded during 'zfs.sh -u'.  This avoids
the issue of the script failing because there is another consumer
using the module we were not aware of.  In other words the script
restricts unloading modules to only the spl/zfs modules.

Closes #78
2010-11-11 11:38:25 -08:00

66 lines
1.8 KiB
Bash

#!/bin/bash
KERNELSRC=@LINUX@
KERNELBUILD=@LINUX_OBJ@
KERNELSRCVER=@LINUX_VERSION@
KERNELMOD=/lib/modules/${KERNELSRCVER}/kernel
SPLSRC=@SPL@
SPLBUILD=@SPL_OBJ@
SPLSRCVER=@SPL_VERSION@
SRCDIR=@abs_top_srcdir@
BUILDDIR=@abs_top_builddir@
LIBDIR=${BUILDDIR}/lib
CMDDIR=${BUILDDIR}/cmd
MODDIR=${BUILDDIR}/module
SCRIPTDIR=${BUILDDIR}/scripts
ZPOOLDIR=${BUILDDIR}/scripts/zpool-config
ZPIOSDIR=${BUILDDIR}/scripts/zpios-test
ZPIOSPROFILEDIR=${BUILDDIR}/scripts/zpios-profile
ETCDIR=${SRCDIR}/etc
ZDB=${CMDDIR}/zdb/zdb
ZFS=${CMDDIR}/zfs/zfs
ZINJECT=${CMDDIR}/zinject/zinject
ZPOOL=${CMDDIR}/zpool/zpool
ZPOOL_ID=${CMDDIR}/zpool_id/zpool_id
ZTEST=${CMDDIR}/ztest/ztest
ZPIOS=${CMDDIR}/zpios/zpios
COMMON_SH=${SCRIPTDIR}/common.sh
ZFS_SH=${SCRIPTDIR}/zfs.sh
ZPOOL_CREATE_SH=${SCRIPTDIR}/zpool-create.sh
ZPIOS_SH=${SCRIPTDIR}/zpios.sh
ZPIOS_SURVEY_SH=${SCRIPTDIR}/zpios-survey.sh
INTREE=1
LDMOD=/sbin/insmod
KERNEL_MODULES=( \
${KERNELMOD}/lib/zlib_deflate/zlib_deflate.ko \
${KERNELMOD}/lib/zlib_inflate/zlib_inflate.ko \
)
SPL_MODULES=( \
${SPLBUILD}/module/spl/spl.ko \
${SPLBUILD}/module/splat/splat.ko \
)
ZFS_MODULES=( \
${MODDIR}/avl/zavl.ko \
${MODDIR}/nvpair/znvpair.ko \
${MODDIR}/unicode/zunicode.ko \
${MODDIR}/zcommon/zcommon.ko \
${MODDIR}/zfs/zfs.ko \
)
ZPIOS_MODULES=( \
${MODDIR}/zpios/zpios.ko \
)
MODULES=( \
${SPL_MODULES[*]} \
${ZFS_MODULES[*]} \
)