mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-27 03:19:35 +03:00
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 <mav@FreeBSD.org> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ryan Moeller <ryan@ixsystems.com> Closes #12083
This commit is contained in:
parent
1282274f33
commit
76bcffb7dc
@ -3137,11 +3137,9 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
|||||||
{
|
{
|
||||||
zfs_cmd_t zc = {"\0"};
|
zfs_cmd_t zc = {"\0"};
|
||||||
char msg[1024];
|
char msg[1024];
|
||||||
char *pathname;
|
|
||||||
nvlist_t *tgt;
|
nvlist_t *tgt;
|
||||||
boolean_t avail_spare, l2cache, islog;
|
boolean_t avail_spare, l2cache, islog;
|
||||||
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
libzfs_handle_t *hdl = zhp->zpool_hdl;
|
||||||
int error;
|
|
||||||
|
|
||||||
if (flags & ZFS_ONLINE_EXPAND) {
|
if (flags & ZFS_ONLINE_EXPAND) {
|
||||||
(void) snprintf(msg, sizeof (msg),
|
(void) snprintf(msg, sizeof (msg),
|
||||||
@ -3161,6 +3159,8 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
|||||||
if (avail_spare)
|
if (avail_spare)
|
||||||
return (zfs_error(hdl, EZFS_ISSPARE, msg));
|
return (zfs_error(hdl, EZFS_ISSPARE, msg));
|
||||||
|
|
||||||
|
#ifndef __FreeBSD__
|
||||||
|
char *pathname;
|
||||||
if ((flags & ZFS_ONLINE_EXPAND ||
|
if ((flags & ZFS_ONLINE_EXPAND ||
|
||||||
zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) &&
|
zpool_get_prop_int(zhp, ZPOOL_PROP_AUTOEXPAND, NULL)) &&
|
||||||
nvlist_lookup_string(tgt, ZPOOL_CONFIG_PATH, &pathname) == 0) {
|
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) {
|
if (wholedisk) {
|
||||||
const char *fullpath = path;
|
const char *fullpath = path;
|
||||||
char buf[MAXPATHLEN];
|
char buf[MAXPATHLEN];
|
||||||
|
int error;
|
||||||
|
|
||||||
if (path[0] != '/') {
|
if (path[0] != '/') {
|
||||||
error = zfs_resolve_shortname(path, buf,
|
error = zfs_resolve_shortname(path, buf,
|
||||||
@ -3197,6 +3198,7 @@ zpool_vdev_online(zpool_handle_t *zhp, const char *path, int flags,
|
|||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
zc.zc_cookie = VDEV_STATE_ONLINE;
|
zc.zc_cookie = VDEV_STATE_ONLINE;
|
||||||
zc.zc_obj = flags;
|
zc.zc_obj = flags;
|
||||||
|
Loading…
Reference in New Issue
Block a user