From c2893298c0b88536340896a05f159d6cdeba989d Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Tue, 26 Jan 2016 12:49:31 +0000 Subject: [PATCH] 6386 Fix function call with uninitialized value in vdev_inuse Reviewed by: Brian Behlendorf Reviewed by: Matthew Ahrens Reviewed by: Dan Kimmel Approved by: Robert Mustacchi Author: Richard Yao illumos/illumos-gate@5bdd995ddb777f538bfbcc5e2d5ff1bed07ae56e --- uts/common/fs/zfs/vdev_label.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/uts/common/fs/zfs/vdev_label.c b/uts/common/fs/zfs/vdev_label.c index c9b0641cfd63..f0924ab1e66e 100644 --- a/uts/common/fs/zfs/vdev_label.c +++ b/uts/common/fs/zfs/vdev_label.c @@ -596,7 +596,8 @@ vdev_inuse(vdev_t *vd, uint64_t crtxg, vdev_labeltype_t reason, * read-only. Instead we look to see if the pools is marked * read-only in the namespace and set the state to active. */ - if ((spa = spa_by_guid(pool_guid, device_guid)) != NULL && + if (state != POOL_STATE_SPARE && state != POOL_STATE_L2CACHE && + (spa = spa_by_guid(pool_guid, device_guid)) != NULL && spa_mode(spa) == FREAD) state = POOL_STATE_ACTIVE;