From 11ba2468a14652b478f2665fb83f56b016697d2a Mon Sep 17 00:00:00 2001 From: riastradh Date: Tue, 28 Dec 2021 17:51:23 +0000 Subject: [PATCH] zfs: Expose hostid to zfs, as in gethostid/sethostid(3). If set to nonzero, the hostid is recorded in the metadata of a zpool, and checked by `zpool import' when the pool has not been explicitly exported. After reboot, zpool import will not need `-f' to reimport the pool. Setting the hostid must be done explicitly through sysctl (or the sethostid(3) library call) on all ports except acorn32, amiga, mvme68k, newsmips, sparc, sparc64, sun2, and sun3. So for most users this change will have no immediate effect. But you can obviate the need for `zpool import -f' by adding `kern.hostid=123456789' to /etc/sysctl.conf and importing the pool one last time with `-f'. --- external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h b/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h index 37a40cea37d3..330a1e754528 100644 --- a/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h +++ b/external/cddl/osnet/dist/uts/common/fs/zfs/sys/zfs_context.h @@ -130,6 +130,7 @@ extern "C" { #include #else /* !__NetBSD__ */ #include +#include #include #include @@ -165,7 +166,7 @@ extern "C" { #define td_ru l_ru #define UID_NOBODY (32767) #define vnode_pager_setsize(vp, size) zfs_netbsd_setsize(vp, size) -#define zone_get_hostid(a) 0 +#define zone_get_hostid(a) ((unsigned)hostid) extern struct utsname utsname;