Project

General

Profile

Actions

Bug #3579

closed

ztest trips assertion in metaslab_weight()

Added by Christopher Siden over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Category:
zfs - Zettabyte File System
Start date:
2013-02-19
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

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.
Actions #1

Updated by Christopher Siden over 8 years ago

  • Status changed from In Progress to Closed
commit 9eb57f7
Author: George Wilson <george.wilson@delphix.com>
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 <mahrens@delphix.com>
    Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
    Reviewed by: Adam Leventhal <ahl@delphix.com>
    Reviewed by: Christopher Siden <christopher.siden@delphix.com>
    Reviewed by: Richard Elling <richard.elling@dey-sys.com>
    Approved by: Dan McDonald <danmcd@nexenta.com>
Actions

Also available in: Atom PDF