Project

General

Profile

Bug #7254

ztest failed assertion in ztest_dataset_dirobj_verify: dirobjs + 1 == usedobjs

Added by Daniel Kimmel about 3 years ago. Updated almost 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
zfs - Zettabyte File System
Start date:
2016-08-02
Due date:
% Done:

100%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage

Description

panic message: assertion failed for thread 0xfffffd7fff152a40, thread-id 1: dirobjs + 1 usedobjs (0x28 0x0), file ../ztest.c, line 5822

::stack

libc.so.1`_lwp_kill+0xa()
libc.so.1`_assfail+0x182(fffffd7fffdff1b0, 41aaab, 16be)
libc.so.1`assfail3+0xe6(41b47e, 28, 41ab87, 0, 41aaab, 16be)
ztest_dataset_dirobj_verify+0x6f(49caf0)
ztest_dataset_open+0xfc(2)
ztest_run+0x2c3(fffffd7fff120498)
main+0x7ff(1, fffffd7fffdffb48)
_start+0x6c()

I believe the problem is that dsl_dataset_space() is looking at the ds_bp's fill count while dmu_objset_write_ready() is concurrently modifying it. We need to use a lock to protect the ds_bp's contents, similar to how we use the dn_struct_rwlock to protect db_blkptr in dbuf_write_ready(). To fix this we will add an rrwlock to protect the ds_bp.

However, we don't need to lock everywhere. In dbuf_dirty(), ds_bp_rwlock protects os_rootbp. However, in one case we are using os_roobp only in an assertion, so we should only grab ds_bp_rwlock on DEBUG builds. In another case, we use os_roobp inside an "if (dn_dirtyctx == UNDIRTIED)", which is only hit the first time a dnode is accessed, so we should only grab the lock inside that "if".

History

#1

Updated by Electric Monk almost 3 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

git commit c166b69d29138aed7a415fe7cef698e54c6ae945

commit  c166b69d29138aed7a415fe7cef698e54c6ae945
Author: Paul Dagnelie <pcd@delphix.com>
Date:   2016-09-24T17:48:28.000Z

    7254 ztest failed assertion in ztest_dataset_dirobj_verify: dirobjs + 1 == usedobjs
    Reviewed by: George Wilson <george.wilson@delphix.com>
    Reviewed by: Prakash Surya <prakash.surya@delphix.com>
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Steve Gonczi <steve.gonczi@delphix.com>
    Approved by: Robert Mustacchi <rm@joyent.com>

Also available in: Atom PDF