Skip to content

Commit

Permalink
Fix ENXIO from spa_ld_verify_logs() in ztest
Browse files Browse the repository at this point in the history
This patch fixes a small issue where the zil_check_log_chain()
code path would hit an EBUSY error. This would occur when
2 threads attempted to call metaslab_activate() at the same time.
In this case, the "loser" would receive an error code which should
have been ignored, but was instead floated to the caller. This
ended up resulting in an ENXIO being returned from from
spa_ld_verify_logs().

Signed-off-by: Tom Caputi <[email protected]>

TEST_ZTEST_TIMEOUT=7200
  • Loading branch information
Tom Caputi committed Oct 19, 2018
1 parent d7dd8e9 commit 147ec82
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions module/zfs/metaslab.c
Original file line number Diff line number Diff line change
Expand Up @@ -2049,7 +2049,7 @@ metaslab_activate(metaslab_t *msp, int allocator, uint64_t activation_weight)
* The metaslab was activated for another allocator
* while we were waiting, we should reselect.
*/
return (EBUSY);
return (SET_ERROR(EBUSY));
}
if ((error = metaslab_activate_allocator(msp->ms_group, msp,
allocator, activation_weight)) != 0) {
Expand Down Expand Up @@ -3893,8 +3893,13 @@ metaslab_claim_concrete(vdev_t *vd, uint64_t offset, uint64_t size,

mutex_enter(&msp->ms_lock);

if ((txg != 0 && spa_writeable(spa)) || !msp->ms_loaded)
if ((txg != 0 && spa_writeable(spa)) || !msp->ms_loaded) {
error = metaslab_activate(msp, 0, METASLAB_WEIGHT_CLAIM);
if (error == EBUSY) {
ASSERT(msp->ms_weight & METASLAB_ACTIVE_MASK);
error = 0;
}
}

if (error == 0 &&
!range_tree_contains(msp->ms_allocatable, offset, size))
Expand Down

0 comments on commit 147ec82

Please sign in to comment.