]> git.proxmox.com Git - mirror_spl.git/commit - module/spl/spl-generic.c
Determine the hostid on demand.
authorEtienne Dechamps <etienne.dechamps@ovh.net>
Thu, 5 Jul 2012 07:22:03 +0000 (09:22 +0200)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 26 Jul 2012 22:14:02 +0000 (15:14 -0700)
commita9f2397ee9f8c1e2c18072361f1f819155242ed2
tree0123e98d984351d9b7fdff9f4a5479e617d7fbde
parentc167aadb27d51b7be9ee7bd582e2795061a68480
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
module/spl/spl-generic.c