mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-11-17 10:01:01 +03:00
OpenZFS 8641 - "zpool clear" and "zinject" don't work on "spare" or "replacing" vdevs
Add "spare" and "replacing" to the list of interior vdev types in zpool_vdev_is_interior(), alongside the existing "mirror" and "raidz". This fixes running "zinject -d" and "zpool clear" on spare and replacing vdevs. Authored by: Alan Somers <asomers@gmail.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: George Melikov <mail@gmelikov.ru> Approved by: Gordon Ross <gwr@nexenta.com> Ported-by: Brian Behlendorf <behlendorf1@llnl.gov> OpenZFS-issue: https://www.illumos.org/issues/8641 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/9a36801382 Closes #7060
This commit is contained in:
parent
7da8f8d81b
commit
1574c73bd0
@ -53,6 +53,7 @@
|
|||||||
#include "zfeature_common.h"
|
#include "zfeature_common.h"
|
||||||
|
|
||||||
static int read_efi_label(nvlist_t *config, diskaddr_t *sb);
|
static int read_efi_label(nvlist_t *config, diskaddr_t *sb);
|
||||||
|
static boolean_t zpool_vdev_is_interior(const char *name);
|
||||||
|
|
||||||
typedef struct prop_flags {
|
typedef struct prop_flags {
|
||||||
int create:1; /* Validate property on creation */
|
int create:1; /* Validate property on creation */
|
||||||
@ -2131,10 +2132,7 @@ vdev_to_nvlist_iter(nvlist_t *nv, nvlist_t *search, boolean_t *avail_spare,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
verify(strncmp(type, VDEV_TYPE_RAIDZ,
|
verify(zpool_vdev_is_interior(type));
|
||||||
strlen(VDEV_TYPE_RAIDZ)) == 0 ||
|
|
||||||
strncmp(type, VDEV_TYPE_MIRROR,
|
|
||||||
strlen(VDEV_TYPE_MIRROR)) == 0);
|
|
||||||
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID,
|
verify(nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ID,
|
||||||
&id) == 0);
|
&id) == 0);
|
||||||
|
|
||||||
@ -2241,10 +2239,13 @@ zpool_find_vdev_by_physpath(zpool_handle_t *zhp, const char *ppath,
|
|||||||
/*
|
/*
|
||||||
* Determine if we have an "interior" top-level vdev (i.e mirror/raidz).
|
* Determine if we have an "interior" top-level vdev (i.e mirror/raidz).
|
||||||
*/
|
*/
|
||||||
boolean_t
|
static boolean_t
|
||||||
zpool_vdev_is_interior(const char *name)
|
zpool_vdev_is_interior(const char *name)
|
||||||
{
|
{
|
||||||
if (strncmp(name, VDEV_TYPE_RAIDZ, strlen(VDEV_TYPE_RAIDZ)) == 0 ||
|
if (strncmp(name, VDEV_TYPE_RAIDZ, strlen(VDEV_TYPE_RAIDZ)) == 0 ||
|
||||||
|
strncmp(name, VDEV_TYPE_SPARE, strlen(VDEV_TYPE_SPARE)) == 0 ||
|
||||||
|
strncmp(name,
|
||||||
|
VDEV_TYPE_REPLACING, strlen(VDEV_TYPE_REPLACING)) == 0 ||
|
||||||
strncmp(name, VDEV_TYPE_MIRROR, strlen(VDEV_TYPE_MIRROR)) == 0)
|
strncmp(name, VDEV_TYPE_MIRROR, strlen(VDEV_TYPE_MIRROR)) == 0)
|
||||||
return (B_TRUE);
|
return (B_TRUE);
|
||||||
return (B_FALSE);
|
return (B_FALSE);
|
||||||
|
Loading…
Reference in New Issue
Block a user