summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuri Pankov <yuri.pankov@nexenta.com>2017-04-24 09:46:17 -0700
committerMatthew Ahrens <mahrens@delphix.com>2017-04-24 19:51:34 -0700
commit5f368aef86387d6ef4eda84030ae9b402313ee4c (patch)
tree19b2f44fccf237134671a2aa87964dba711194fd
parent15f8fb316fc55565c224927c040311780c39041b (diff)
downloadillumos-joyent-5f368aef86387d6ef4eda84030ae9b402313ee4c.tar.gz
7786 zfs`vdev_online() needs better notification about state changes
Reviewed by: Matthew Ahrens mahrens@delphix.com Reviewed by: George Wilson george.wilson@delphix.com Approved by: Albert Lee <trisk@forkgnu.org>
-rw-r--r--usr/src/uts/common/fs/zfs/vdev.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c
index d43745cd11..d8a31dcab1 100644
--- a/usr/src/uts/common/fs/zfs/vdev.c
+++ b/usr/src/uts/common/fs/zfs/vdev.c
@@ -22,7 +22,7 @@
/*
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
- * Copyright 2015 Nexenta Systems, Inc. All rights reserved.
+ * Copyright 2017 Nexenta Systems, Inc.
* Copyright (c) 2014 Integros [integros.com]
* Copyright 2016 Toomas Soome <tsoome@me.com>
*/
@@ -2450,7 +2450,8 @@ int
vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate)
{
vdev_t *vd, *tvd, *pvd, *rvd = spa->spa_root_vdev;
- boolean_t postevent = B_FALSE;
+ boolean_t wasoffline;
+ vdev_state_t oldstate;
spa_vdev_state_enter(spa, SCL_NONE);
@@ -2460,9 +2461,8 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate)
if (!vd->vdev_ops->vdev_op_leaf)
return (spa_vdev_state_exit(spa, NULL, ENOTSUP));
- postevent =
- (vd->vdev_offline == B_TRUE || vd->vdev_tmpoffline == B_TRUE) ?
- B_TRUE : B_FALSE;
+ wasoffline = (vd->vdev_offline || vd->vdev_tmpoffline);
+ oldstate = vd->vdev_state;
tvd = vd->vdev_top;
vd->vdev_offline = B_FALSE;
@@ -2500,7 +2500,9 @@ vdev_online(spa_t *spa, uint64_t guid, uint64_t flags, vdev_state_t *newstate)
spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE);
}
- if (postevent)
+ if (wasoffline ||
+ (oldstate < VDEV_STATE_DEGRADED &&
+ vd->vdev_state >= VDEV_STATE_DEGRADED))
spa_event_notify(spa, vd, ESC_ZFS_VDEV_ONLINE);
return (spa_vdev_state_exit(spa, vd, 0));