From d1de72cfa29ab77ff80e2bb0e668a6afa5bccaf0 Mon Sep 17 00:00:00 2001 From: Pavel Zakharov Date: Wed, 19 Oct 2016 17:46:08 -0400 Subject: 9187 racing condition between vdev label and spa_last_synced_txg in vdev_validate Reviewed by: George Wilson Reviewed by: Matt Ahrens Approved by: Robert Mustacchi --- usr/src/uts/common/fs/zfs/vdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); -- cgit v1.2.3