HomeFreeBSD

Determine the hostid on demand.

Description

Determine the hostid on demand.

Currently, the SPL tries to determine the hostid at module load. The
hostid is usually determined by running the userland program "hostid"
during module initialization.

Unfortunately, when the module initializes, it may be way too soon to be
able to run any userland programs. This is especially true when the
module is compiled directly inside the kernel (built-in); in that case,
the SPL would try to run hostid when the kernel is still initializing,
which of course is doomed to fail.

This patch fixes the issue by deferring hostid generation until
something actually needs the hostid (that is, when zone_get_hostid() is
called), thus switching to a "on-initialization" model to a "on-demand"
(lazy loading) model. ZFS only needs the hostid when some pool
operations are requested, and this always happens way after the kernel
has finished initialization, thus solving the problem.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Issue zfsonlinux/zfs#851

Details

Provenance
Etienne Dechamps <etienne.dechamps@ovh.net>Authored on Jul 5 2012, 7:22 AM
Brian Behlendorf <behlendorf1@llnl.gov>Committed on Jul 26 2012, 10:14 PM
Parents
rGc167aadb27d5: Add script for builtin module building.
Branches
Unknown
Tags
Unknown

Event Timeline

Brian Behlendorf <behlendorf1@llnl.gov> committed rGa9f2397ee9f8: Determine the hostid on demand. (authored by Etienne Dechamps <etienne.dechamps@ovh.net>).Jul 26 2012, 10:14 PM