ztest trips assertion in metaslab_weight()
zfs - Zettabyte File System
From George Wilson's bug report at Delphix:
While running ztest I hit this assertion: assertion failed for thread 0xf8a01240, thread-id 471: weight >= space && weight <= 2 * space, file ../../../uts/common/fs/zfs/metaslab.c, line 827 This bug has been around from the days at Sun and is very hard to hit. I finally understand what is happening: 1). the metaslab that we're working on in metaslab_weight() happens to a vdev that is being removed (i.e. a slog) 2). since it's being removed we have already destroyed its space_map object along with the metaslab array. 3). the metaslab group associated with this vdev is still being processed and calls metaslab_weight() In metaslab_weight() we do the following: space = sm->sm_size - smo->smo_alloc; weight = space; weight = 2 * weight - ((sm->sm_start >> vd->vdev_ms_shift) * weight) / vd->vdev_ms_count; ASSERT(weight >= space && weight <= 2 * space); Since this vdev has been removed the above calculation turn into the following: space = sm->sm_size; weight = space; weight = 2 * weight - (sm->sm_start * weight) / vd->vdev_ms_count; This results in weight being an very large number and we trip the assertion.
Updated by Christopher Siden over 8 years ago
- Status changed from In Progress to Closed
commit 9eb57f7 Author: George Wilson <firstname.lastname@example.org> Date: Wed Feb 20 13:30:36 2013 3578 transferring the freed map to the defer map should be constant time 3579 ztest trips assertion in metaslab_weight() Reviewed by: Matthew Ahrens <email@example.com> Reviewed by: Dan Kimmel <firstname.lastname@example.org> Reviewed by: Adam Leventhal <email@example.com> Reviewed by: Christopher Siden <firstname.lastname@example.org> Reviewed by: Richard Elling <email@example.com> Approved by: Dan McDonald <firstname.lastname@example.org>