1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-11 14:10:34 +00:00

zfs: fix label validation code in vdev_geom_read_config

POOL_STATE_SPARE and POOL_STATE_L2CACHE were not handled correctly
and thus the cache and spare disks would not be correctly probed.

Reported by:	Michael Schmiedgen <schmiedgen@gmx.net>,
		Matthew D. Fuller <fullermd@over-yonder.net>
Tested by:	Michael Schmiedgen <schmiedgen@gmx.net>,
		flo
MFC after:	5 days
This commit is contained in:
Andriy Gapon 2012-10-26 14:50:16 +00:00
parent b5ebea0f5b
commit 86812da016
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=242135

View File

@ -270,14 +270,16 @@ vdev_geom_read_config(struct g_consumer *cp, nvlist_t **config)
continue;
if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_STATE,
&state) != 0 || state >= POOL_STATE_DESTROYED) {
&state) != 0 || state == POOL_STATE_DESTROYED ||
state > POOL_STATE_L2CACHE) {
nvlist_free(*config);
*config = NULL;
continue;
}
if (nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_TXG,
&txg) != 0 || txg == 0) {
if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE &&
(nvlist_lookup_uint64(*config, ZPOOL_CONFIG_POOL_TXG,
&txg) != 0 || txg == 0)) {
nvlist_free(*config);
*config = NULL;
continue;