mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Use gethostid in the Linux convention.
Disable the gethostid() override for Solaris behavior because Linux systems implement the POSIX standard in a way that allows a negative result. Mask the gethostid() result to the lower four bytes, like coreutils does in /usr/bin/hostid, to prevent junk bits or sign-extension on systems that have an eight byte long type. This can cause a spurious hostid mismatch that prevents zpool import on 64-bit systems.
This commit is contained in:
@@ -1533,7 +1533,9 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts,
|
||||
|
||||
if (nvlist_lookup_uint64(config, ZPOOL_CONFIG_HOSTID,
|
||||
&hostid) == 0) {
|
||||
if ((unsigned long)hostid != gethostid()) {
|
||||
unsigned long system_hostid = gethostid() & 0xffffffff;
|
||||
|
||||
if ((unsigned long)hostid != system_hostid) {
|
||||
char *hostname;
|
||||
uint64_t timestamp;
|
||||
time_t t;
|
||||
|
||||
Reference in New Issue
Block a user