Project

General

Profile

Actions

Bug #3513

closed

mismatch between SA header size and layout

Added by Christopher Siden almost 11 years ago. Updated almost 11 years ago.

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

100%

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

Description

This is a port of a ZoL fix. From their description:

When a system attribute layout is created an inconsistency may occur
between the system attribute header (sa_hdr_phys_t) size and the
variable-sized attribute count stored in the layout.  The inconsistency
results in the following failed assertion when SA_HDR_SIZE_MATCH_LAYOUT
returns false:

SPLError: 11315:0:(sa.c:1541:sa_find_idx_tab())
ASSERTION((IS_SA_BONUSTYPE(bonustype) && SA_HDR_SIZE_MATCH_LAYOUT(hdr,
tb)) || !IS_SA_BONUSTYPE(bonustype) || (IS_SA_BONUSTYPE(bonustype) &&
hdr->sa_layout_info == 0)) failed

The bug originates in this snippet from sa_find_sizes().

    if (is_var_sz && var_size > 1) {
            if (P2ROUNDUP(hdrsize + sizeof (uint16_t),
                *total < full_space) {
                    hdrsize += sizeof (uint16_t);

This assumes that the current variable-sized attribute will be stored in
the current buffer and accounts for the space needed to store its size
in the sa_hdr_phys_t. However if the next attribute spills over we need
to store a blkptr_t at the end of the bonus buffer to point to the spill
block. If the current attribute is in the way of the blkptr_t then it
too will be relocated into the spill block. But since we've already
accounted for it in the header size we get the inconsistency described
above.

To avoid this, record the index of the last variable-sized attribute
that prompted a hdrsize increase, and reverse the increase if we later
determine that that attribute will be relocated to the spill block.
Actions #1

Updated by Christopher Siden almost 11 years ago

  • Status changed from New to Closed
  • % Done changed from 0 to 100
commit 644b952
Author: Ned Bass <bass6@llnl.gov>
Date:   Fri Feb 8 13:19:22 2013

    3512 rounding discrepancy in sa_find_sizes()
    3513 mismatch between SA header size and layout
    Reviewed by: Matthew Ahrens <mahrens@delphix.com>
    Reviewed by: Boris Protopopov <boris.protopopov@nexenta.com>
    Approved by: Dan McDonald <danmcd@nexenta.com>
Actions

Also available in: Atom PDF