diff options
Diffstat (limited to 'usr/src/uts/common/fs/zfs/vdev_label.c')
| -rw-r--r-- | usr/src/uts/common/fs/zfs/vdev_label.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/usr/src/uts/common/fs/zfs/vdev_label.c b/usr/src/uts/common/fs/zfs/vdev_label.c index 8d5f17c15f..17553607a5 100644 --- a/usr/src/uts/common/fs/zfs/vdev_label.c +++ b/usr/src/uts/common/fs/zfs/vdev_label.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2018 by Delphix. All rights reserved. + * Copyright 2019 Joyent, Inc. */ /* @@ -193,14 +194,21 @@ vdev_label_read(zio_t *zio, vdev_t *vd, int l, abd_t *buf, uint64_t offset, ZIO_PRIORITY_SYNC_READ, flags, B_TRUE)); } -static void +void vdev_label_write(zio_t *zio, vdev_t *vd, int l, abd_t *buf, uint64_t offset, uint64_t size, zio_done_func_t *done, void *private, int flags) { +#ifdef _KERNEL + /* + * This assert is invalid in the user-level ztest MMP code because + * the ztest thread is not in dsl_pool_sync_context. ZoL does not + * build the user-level code with DEBUG so this is not an issue there. + */ ASSERT(spa_config_held(zio->io_spa, SCL_ALL, RW_WRITER) == SCL_ALL || (spa_config_held(zio->io_spa, SCL_CONFIG | SCL_STATE, RW_READER) == (SCL_CONFIG | SCL_STATE) && dsl_pool_sync_context(spa_get_dsl(zio->io_spa)))); +#endif ASSERT(flags & ZIO_FLAG_CONFIG_WRITER); zio_nowait(zio_write_phys(zio, vd, @@ -1142,7 +1150,8 @@ vdev_uberblock_sync(zio_t *zio, uint64_t *good_writes, if (!vdev_writeable(vd)) return; - int n = ub->ub_txg & (VDEV_UBERBLOCK_COUNT(vd) - 1); + int m = spa_multihost(vd->vdev_spa) ? MMP_BLOCKS_PER_LABEL : 0; + int n = ub->ub_txg % (VDEV_UBERBLOCK_COUNT(vd) - m); /* Copy the uberblock_t into the ABD */ abd_t *ub_abd = abd_alloc_for_io(VDEV_UBERBLOCK_SIZE(vd), B_TRUE); @@ -1360,10 +1369,13 @@ retry: * and the vdev configuration hasn't changed, * then there's nothing to do. */ - if (ub->ub_txg < txg && - uberblock_update(ub, spa->spa_root_vdev, txg) == B_FALSE && - list_is_empty(&spa->spa_config_dirty_list)) - return (0); + if (ub->ub_txg < txg) { + boolean_t changed = uberblock_update(ub, spa->spa_root_vdev, + txg, spa->spa_mmp.mmp_delay); + + if (!changed && list_is_empty(&spa->spa_config_dirty_list)) + return (0); + } if (txg > spa_freeze_txg(spa)) return (0); @@ -1426,6 +1438,9 @@ retry: goto retry; } + if (spa_multihost(spa)) + mmp_update_uberblock(spa, ub); + /* * Sync out odd labels for every dirty vdev. If the system dies * in the middle of this process, the even labels and the new |
