summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPavel Zakharov <pavel.zakharov@delphix.com>2016-10-19 17:46:08 -0400
committerPrakash Surya <prakash.surya@delphix.com>2018-03-19 11:21:36 -0700
commitd1de72cfa29ab77ff80e2bb0e668a6afa5bccaf0 (patch)
tree3d1067ad5154908c6c6aee9f8d323d422f51b496
parent859bfead58cf0e8c589b713386bab81385a346e6 (diff)
downloadillumos-joyent-d1de72cfa29ab77ff80e2bb0e668a6afa5bccaf0.tar.gz
9187 racing condition between vdev label and spa_last_synced_txg in vdev_validate
Reviewed by: George Wilson <george.wilson@delphix.com> Reviewed by: Matt Ahrens <matthew.ahrens@delphix.com> Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r--usr/src/uts/common/fs/zfs/vdev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/usr/src/uts/common/fs/zfs/vdev.c b/usr/src/uts/common/fs/zfs/vdev.c
index d7434c7ddc..388d13716c 100644
--- a/usr/src/uts/common/fs/zfs/vdev.c
+++ b/usr/src/uts/common/fs/zfs/vdev.c
@@ -1573,8 +1573,11 @@ vdev_validate(vdev_t *vd)
/*
* If we are performing an extreme rewind, we allow for a label that
* was modified at a point after the current txg.
+ * If config lock is not held do not check for the txg. spa_sync could
+ * be updating the vdev's label before updating spa_last_synced_txg.
*/
- if (spa->spa_extreme_rewind || spa_last_synced_txg(spa) == 0)
+ if (spa->spa_extreme_rewind || spa_last_synced_txg(spa) == 0 ||
+ spa_config_held(spa, SCL_CONFIG, RW_WRITER) != SCL_CONFIG)
txg = UINT64_MAX;
else
txg = spa_last_synced_txg(spa);