summaryrefslogtreecommitdiffstats
path: root/module
diff options
context:
space:
mode:
authorYuri Pankov <[email protected]>2017-04-26 14:55:10 -0400
committerBrian Behlendorf <[email protected]>2017-05-01 16:24:37 -0400
commit153b2285545509c082be56dbf3ba5041de5d6e48 (patch)
treeaa469b00d65e0c69ae885d48ba67d209ea06367d /module
parente99932f7dec6efeb006e225e0bf0901c30345cac (diff)
OpenZFS 7786 - zfs`vdev_online() needs better notification about state changes
Authored by: Yuri Pankov <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Reviewed by: George Wilson <[email protected]> Approved by: Albert Lee <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Ported-by: bunder2015 <[email protected]> OpenZFS-issue: https://www.illumos.org/issues/7786 OpenZFS-commit: http://github.com/openzfs/openzfs/commit/db8498f Closes #6074
Diffstat (limited to 'module')
-rw-r--r--module/zfs/vdev.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c
index caf92899d..da0639102 100644
--- a/module/zfs/vdev.c
+++ b/module/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 <[email protected]>
*/
@@ -2530,7 +2530,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);
@@ -2540,9 +2541,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;
@@ -2580,7 +2580,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));