zfsonlinux/spl — pull request #342 by clefru (2014-03-29 08:02:12+00:00)
Title: Set hw_serial also when we read /etc/hostid

By jumping through userspace, hostid_exec triggers a write to the proc
write helper for hostid. This, in addition to setting hostid, writes
the hostid into the hw_serial string. This isn't done for the
hostid_read path. The fix is to factor this code out to
zone_get_hostid.

The side-effect of not having hw_serial set is that no hostid is
written to pools on "zpool export". Check that
/proc/sys/kernel/spl/hw_serial is "", create a new pool, and
export it. Verify that zdb -CC -e yourpool doesn't show your hostid.
Run "hostid 1> /proc/sys/kernel/spl/hostid" and redo the above. Now
your pool has a hostid.

This is partially described in:
https://groups.google.com/a/zfsonlinux.org/forum/#!topic/zfs-discuss/UekOyCd1OO0