Skip to content

Commit

Permalink
Moving the metaslab_group_set_rotor_category() up.
Browse files Browse the repository at this point in the history
ztest did an (unreproducible) failure with stack trace of
spa_tryimport() -> ... vdev_load() -> ... vdev_metaslab_init() ->
metaslab_init() -> ... metaslab_class_space_update() that failed its
ASSERT.  Inspection showed that vdev_metaslab_init() would soon call
metaslab_group_activate(), i.e. we need to assign mg_nrot.
(Hopefully, vdev_open was called earlier...?)
  • Loading branch information
inkdot7 committed Sep 25, 2016
1 parent 8de31f3 commit 7344532
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions module/zfs/vdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,20 @@ vdev_open(vdev_t *vd)

error = vd->vdev_ops->vdev_op_open(vd, &osize, &max_osize, &ashift);

/*
* Somewhere after vd->vdev_ops->vdev_op_open() (that calls
* vdev_open_children() and thus updates vd->vdev_nonrot) and
* before metaslab_class_space_update() gets called, we need
* to assign the rotor category of the metaslab group.
*
* At this point, the metaslab group has already been created.
*
* Do the handling here, before any return in case error has
* been set.
*/
if (vd->vdev_mg)
metaslab_group_set_rotor_category(vd->vdev_mg);

/*
* Reset the vdev_reopening flag so that we actually close
* the vdev on error.
Expand Down Expand Up @@ -1388,18 +1402,6 @@ vdev_open(vdev_t *vd)
vdev_resilver_needed(vd, NULL, NULL))
spa_async_request(spa, SPA_ASYNC_RESILVER);

/*
* Somewhere after vd->vdev_ops->vdev_op_open() (that calls
* vdev_open_children() and thus updates vd->vdev_nonrot) and
* before metaslab_class_space_update() gets called, we need
* to assign the rotor category of the metaslab group.
*
* At this point, the metaslab group has already been created,
* so go for it.
*/
if (vd->vdev_mg)
metaslab_group_set_rotor_category(vd->vdev_mg);

return (0);
}

Expand Down

0 comments on commit 7344532

Please sign in to comment.