diff options
author | Ryan Moeller <[email protected]> | 2022-03-11 11:52:49 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2022-03-11 08:52:49 -0800 |
commit | 76bcffb7dc7ef620d186caacab266532fb293fde (patch) | |
tree | e8f0a7ce34fefcfc0f7f7a0c4d5f5b11395599c2 /lib/libzfs/libzfs_pool.c | |
parent | 1282274f3355bcd11bdae911d9279ef1892f7061 (diff) |
libzfs: FreeBSD doesn't resize partitions for you
This code can be failure prone on FreeBSD, where zfsd will pass a guid
as the vdev path to online. The guid causes zfs_resolve_shortname to
fail because it expects a path. We can just skip the whole ordeal.
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #12083
Diffstat (limited to 'lib/libzfs/libzfs_pool.c')
-rw-r--r-- | lib/libzfs/libzfs_pool.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index fe58221a0..b632ff74a 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -3137,11 +3137,9 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags, { zfs_cmd_t zc = {"\0"}; char msg[1024]; - char *pathname; nvlist_t *tgt; boolean_t avail_spare, l2cache, islog; libzfs_handle_t *hdl = zhp->zpool_hdl; - int error; if (flags & ZFS_ONLINE_EXPAND) { (void) snprintf(msg, sizeof (msg), @@ -3161,6 +3159,8 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags, if (avail_spare) return (zfs_error(hdl, EZFS_ISSPARE, msg)); +#ifndef __FreeBSD__ + char *pathname; if ((flags & ZFS_ONLINE_EXPAND || zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) && nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &pathname) == 0) { @@ -3181,6 +3181,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags, if (wholedisk) { const char *fullpath = path; char buf[MAXPATHLEN]; + int error; if (path[0] != '/') { error = zfs_resolve_shortname(path, buf, @@ -3197,6 +3198,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags, return (error); } } +#endif zc.zc_cookie = VDEV_STATE_ONLINE; zc.zc_obj = flags; |