summaryrefslogtreecommitdiffstats
path: root/module/zfs/vdev_label.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2016-01-26 17:27:46 -0800
committerBrian Behlendorf <[email protected]>2016-01-28 12:44:39 -0500
commitb6fcb792ca2dad7fb2d190efa416ad8b718675b4 (patch)
tree9b8462e99bff3eb617c53853b9bf62a94b75f50d /module/zfs/vdev_label.c
parent1a04bab34808694f3bf1cef3dc208c9499d103aa (diff)
Illumos 6414 - vdev_config_sync could be simpler
6414 vdev_config_sync could be simpler Reviewed by: George Wilson <[email protected]> Reviewed by: Matthew Ahrens <[email protected]> Approved by: Robert Mustacchi <[email protected]> References: https://www.illumos.org/issues/6414 https://github.com/illumos/illumos-gate/commit/eb5bb58 Ported-by: Brian Behlendorf <[email protected]> Signed-off-by: Chunwei Chen <[email protected]>
Diffstat (limited to 'module/zfs/vdev_label.c')
-rw-r--r--module/zfs/vdev_label.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c
index 419cbc1a0..9d4229ac8 100644
--- a/module/zfs/vdev_label.c
+++ b/module/zfs/vdev_label.c
@@ -1187,15 +1187,16 @@ vdev_label_sync_list(spa_t *spa, int l, uint64_t txg, int flags)
* at any time, you can just call it again, and it will resume its work.
*/
int
-vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, boolean_t tryhard)
+vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg)
{
spa_t *spa = svd[0]->vdev_spa;
uberblock_t *ub = &spa->spa_uberblock;
vdev_t *vd;
zio_t *zio;
- int error;
+ int error = 0;
int flags = ZIO_FLAG_CONFIG_WRITER | ZIO_FLAG_CANFAIL;
+retry:
/*
* Normally, we don't want to try too hard to write every label and
* uberblock. If there is a flaky disk, we don't want the rest of the
@@ -1203,8 +1204,11 @@ vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, boolean_t tryhard)
* single label out, we should retry with ZIO_FLAG_TRYHARD before
* bailing out and declaring the pool faulted.
*/
- if (tryhard)
+ if (error != 0) {
+ if ((flags & ZIO_FLAG_TRYHARD) != 0)
+ return (error);
flags |= ZIO_FLAG_TRYHARD;
+ }
ASSERT(ub->ub_txg <= txg);
@@ -1248,7 +1252,7 @@ vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, boolean_t tryhard)
* are committed to stable storage before the uberblock update.
*/
if ((error = vdev_label_sync_list(spa, 0, txg, flags)) != 0)
- return (error);
+ goto retry;
/*
* Sync the uberblocks to all vdevs in svd[].
@@ -1266,7 +1270,7 @@ vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, boolean_t tryhard)
* to the new uberblocks.
*/
if ((error = vdev_uberblock_sync_list(svd, svdcount, ub, flags)) != 0)
- return (error);
+ goto retry;
/*
* Sync out odd labels for every dirty vdev. If the system dies
@@ -1278,5 +1282,8 @@ vdev_config_sync(vdev_t **svd, int svdcount, uint64_t txg, boolean_t tryhard)
* to disk to ensure that all odd-label updates are committed to
* stable storage before the next transaction group begins.
*/
- return (vdev_label_sync_list(spa, 1, txg, flags));
+ if ((error = vdev_label_sync_list(spa, 1, txg, flags)) != 0)
+ goto retry;
+
+ return (0);
}