mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
OpenZFS 5561 - support root pools on EFI/GPT partitioned disks
Reviewed by: Jean McCormack <jean.mccormack@nexenta.com> Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com> Approved by: Dan McDonald <danmcd@omniti.com> Reviewed-by: George Melikov <mail@gmelikov.ru> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> OpenZFS-issue: https://www.illumos.org/issues/5561 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/1a902ef Closes #5672
This commit is contained in:
parent
258553d3d7
commit
986dd8aacc
@ -415,29 +415,6 @@ bootfs_name_valid(const char *pool, char *bootfs)
|
|||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
/*
|
|
||||||
* Inspect the configuration to determine if any of the devices contain
|
|
||||||
* an EFI label.
|
|
||||||
*/
|
|
||||||
static boolean_t
|
|
||||||
pool_uses_efi(nvlist_t *config)
|
|
||||||
{
|
|
||||||
nvlist_t **child;
|
|
||||||
uint_t c, children;
|
|
||||||
|
|
||||||
if (nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_CHILDREN,
|
|
||||||
&child, &children) != 0)
|
|
||||||
return (read_efi_label(config, NULL) >= 0);
|
|
||||||
|
|
||||||
for (c = 0; c < children; c++) {
|
|
||||||
if (pool_uses_efi(child[c]))
|
|
||||||
return (B_TRUE);
|
|
||||||
}
|
|
||||||
return (B_FALSE);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
boolean_t
|
boolean_t
|
||||||
zpool_is_bootable(zpool_handle_t *zhp)
|
zpool_is_bootable(zpool_handle_t *zhp)
|
||||||
{
|
{
|
||||||
@ -466,7 +443,6 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
|
|||||||
char *slash, *check;
|
char *slash, *check;
|
||||||
struct stat64 statbuf;
|
struct stat64 statbuf;
|
||||||
zpool_handle_t *zhp;
|
zpool_handle_t *zhp;
|
||||||
nvlist_t *nvroot;
|
|
||||||
|
|
||||||
if (nvlist_alloc(&retprops, NV_UNIQUE_NAME, 0) != 0) {
|
if (nvlist_alloc(&retprops, NV_UNIQUE_NAME, 0) != 0) {
|
||||||
(void) no_memory(hdl);
|
(void) no_memory(hdl);
|
||||||
@ -606,23 +582,6 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname,
|
|||||||
(void) zfs_error(hdl, EZFS_OPENFAILED, errbuf);
|
(void) zfs_error(hdl, EZFS_OPENFAILED, errbuf);
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
verify(nvlist_lookup_nvlist(zpool_get_config(zhp, NULL),
|
|
||||||
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
/*
|
|
||||||
* bootfs property cannot be set on a disk which has
|
|
||||||
* been EFI labeled.
|
|
||||||
*/
|
|
||||||
if (pool_uses_efi(nvroot)) {
|
|
||||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
|
||||||
"property '%s' not supported on "
|
|
||||||
"EFI labeled devices"), propname);
|
|
||||||
(void) zfs_error(hdl, EZFS_POOL_NOTSUP, errbuf);
|
|
||||||
zpool_close(zhp);
|
|
||||||
goto error;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
zpool_close(zhp);
|
zpool_close(zhp);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1380,26 +1339,6 @@ zpool_add(zpool_handle_t *zhp, nvlist_t *nvroot)
|
|||||||
return (zfs_error(hdl, EZFS_BADVERSION, msg));
|
return (zfs_error(hdl, EZFS_BADVERSION, msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
if (zpool_is_bootable(zhp) && nvlist_lookup_nvlist_array(nvroot,
|
|
||||||
ZPOOL_CONFIG_SPARES, &spares, &nspares) == 0) {
|
|
||||||
uint64_t s;
|
|
||||||
|
|
||||||
for (s = 0; s < nspares; s++) {
|
|
||||||
char *path;
|
|
||||||
|
|
||||||
if (nvlist_lookup_string(spares[s], ZPOOL_CONFIG_PATH,
|
|
||||||
&path) == 0 && pool_uses_efi(spares[s])) {
|
|
||||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
|
||||||
"device '%s' contains an EFI label and "
|
|
||||||
"cannot be used on root pools."),
|
|
||||||
zpool_vdev_name(hdl, NULL, spares[s], 0));
|
|
||||||
return (zfs_error(hdl, EZFS_POOL_NOTSUP, msg));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL) <
|
if (zpool_get_prop_int(zhp, ZPOOL_PROP_VERSION, NULL) <
|
||||||
SPA_VERSION_L2CACHE &&
|
SPA_VERSION_L2CACHE &&
|
||||||
nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE,
|
nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_L2CACHE,
|
||||||
@ -2357,15 +2296,11 @@ zpool_get_config_physpath(nvlist_t *config, char *physpath, size_t phypath_size)
|
|||||||
&child, &count) != 0)
|
&child, &count) != 0)
|
||||||
return (EZFS_INVALCONFIG);
|
return (EZFS_INVALCONFIG);
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
/*
|
/*
|
||||||
* root pool can not have EFI labeled disks and can only have
|
* root pool can only have a single top-level vdev.
|
||||||
* a single top-level vdev.
|
|
||||||
*/
|
*/
|
||||||
if (strcmp(type, VDEV_TYPE_ROOT) != 0 || count != 1 ||
|
if (strcmp(type, VDEV_TYPE_ROOT) != 0 || count != 1)
|
||||||
pool_uses_efi(vdev_root))
|
|
||||||
return (EZFS_POOL_INVALARG);
|
return (EZFS_POOL_INVALARG);
|
||||||
#endif
|
|
||||||
|
|
||||||
(void) vdev_get_physpaths(child[0], physpath, phypath_size, &rsz,
|
(void) vdev_get_physpaths(child[0], physpath, phypath_size, &rsz,
|
||||||
B_FALSE);
|
B_FALSE);
|
||||||
@ -2672,18 +2607,6 @@ zpool_vdev_attach(zpool_handle_t *zhp,
|
|||||||
(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
|
(void) snprintf(msg, sizeof (msg), dgettext(TEXT_DOMAIN,
|
||||||
"cannot attach %s to %s"), new_disk, old_disk);
|
"cannot attach %s to %s"), new_disk, old_disk);
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
/*
|
|
||||||
* If this is a root pool, make sure that we're not attaching an
|
|
||||||
* EFI labeled device.
|
|
||||||
*/
|
|
||||||
if (rootpool && pool_uses_efi(nvroot)) {
|
|
||||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
|
||||||
"EFI labeled devices are not supported on root pools."));
|
|
||||||
return (zfs_error(hdl, EZFS_POOL_NOTSUP, msg));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
(void) strlcpy(zc.zc_name, zhp->zpool_name, sizeof (zc.zc_name));
|
||||||
if ((tgt = zpool_find_vdev(zhp, old_disk, &avail_spare, &l2cache,
|
if ((tgt = zpool_find_vdev(zhp, old_disk, &avail_spare, &l2cache,
|
||||||
&islog)) == 0)
|
&islog)) == 0)
|
||||||
@ -4237,15 +4160,6 @@ zpool_label_disk(libzfs_handle_t *hdl, zpool_handle_t *zhp, char *name)
|
|||||||
if (zhp) {
|
if (zhp) {
|
||||||
nvlist_t *nvroot;
|
nvlist_t *nvroot;
|
||||||
|
|
||||||
#if defined(__sun__) || defined(__sun)
|
|
||||||
if (zpool_is_bootable(zhp)) {
|
|
||||||
zfs_error_aux(hdl, dgettext(TEXT_DOMAIN,
|
|
||||||
"EFI labeled devices are not supported on root "
|
|
||||||
"pools."));
|
|
||||||
return (zfs_error(hdl, EZFS_POOL_NOTSUP, errbuf));
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
verify(nvlist_lookup_nvlist(zhp->zpool_config,
|
verify(nvlist_lookup_nvlist(zhp->zpool_config,
|
||||||
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0);
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
|
|
||||||
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
||||||
|
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <sys/zfs_context.h>
|
#include <sys/zfs_context.h>
|
||||||
@ -3533,8 +3533,6 @@ vdev_is_bootable(vdev_t *vd)
|
|||||||
strcmp(vdev_type, VDEV_TYPE_MISSING) == 0) {
|
strcmp(vdev_type, VDEV_TYPE_MISSING) == 0) {
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
}
|
}
|
||||||
} else if (vd->vdev_wholedisk == 1) {
|
|
||||||
return (B_FALSE);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (c = 0; c < vd->vdev_children; c++) {
|
for (c = 0; c < vd->vdev_children; c++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user