diff options
author | Ned Bass <[email protected]> | 2015-02-04 13:57:50 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2015-02-06 09:26:46 -0800 |
commit | a62d1b02e372e63862cee276185f2763f641ff10 (patch) | |
tree | 57e64d36fc65b24942b7fd2f71a91c899bb918a3 /module/zfs/dsl_deleg.c | |
parent | e2c4acde55931ae58d5bf5fd394567a96e942a5c (diff) |
Fix SA header size accounting
The functions sa_find_sizes() and sa_build_layout() fail to account
for the additional 2 bytes of SA header space when calculating whether
a variable size attribute might spill over. They may consequently
determine that an attribute will fit in the bonus buffer along with a
spill block pointer, when in reality the attribute would be partially
overwritten by the spill block pointer if spill over occurs. This also
causes an inconsistency between the SA header size and the number of
variable size attributes in the layout, tripping an assertion when
debugging is on. The following reproducer demonstrates the problem.
ln -s $(perl -e 'print "z" x 20') file
setfattr -h -n trusted.foo -v $(perl -e 'print "z" x 200') file
Even though sa_find_sizes() computes the index of the attribute where
spill-over will occur, sa_build_layouts() discards the result and
recomputes it itself. As it turns out, both functions get it wrong.
Since this computation is awkward and, as history has shown, easy to
screw up, let's just do it in one place. This patch fixes the bug in
sa_find_sizes() and updates sa_build_layout() to use the result
computed there.
Also improve the comments in sa_find_sizes().
Signed-off-by: Ned Bass <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tim Chase <[email protected]>
Closes #3070
Diffstat (limited to 'module/zfs/dsl_deleg.c')
0 files changed, 0 insertions, 0 deletions