From 31158fdabb3bb2389e43085279f88a24e84f4516 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Fri, 25 Feb 2022 15:28:06 +0000 Subject: [PATCH] FreeBSD: Fix zfsd auto online The path passed may in fact be a guid, so we want to use the fullpath we looked up from the pool config instead. But, this causes tests to fail on Linux so we only do it for FreeBSD. Signed-off-by: Ryan Moeller --- lib/libzfs/libzfs_pool.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index c6884538df1d..475addbdcd89 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -3072,11 +3072,15 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags, } if (wholedisk) { +#ifdef __FreeBSD__ + const char *fullpath = pathname; +#else const char *fullpath = path; +#endif char buf[MAXPATHLEN]; - if (path[0] != '/') { - error = zfs_resolve_shortname(path, buf, + if (fullpath[0] != '/') { + error = zfs_resolve_shortname(fullpath, buf, sizeof (buf)); if (error != 0) return (zfs_error(hdl, EZFS_NODEVICE,