]> granicus.if.org Git - zfs/commit
Calculate header size correctly in sa_find_sizes()
authorTim Chase <tim@chase2k.com>
Sun, 11 May 2014 01:13:12 +0000 (20:13 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Mon, 19 May 2014 18:55:50 +0000 (11:55 -0700)
commit83021b47c2870c0ba948cbcfe08f41bd7730f5fb
tree33b90baa091ae8c9e1f284bdfd6de6c553fe2020
parent3937ab20f32fc7b79cacfd91c0891f4e1b4ab2de
Calculate header size correctly in sa_find_sizes()

In the case where a variable-sized SA overlaps the spill block pointer and
a new variable-sized SA is being added, the header size was improperly
calculated to include the to-be-moved SA.  This problem could be
reproduced when xattr=sa enabled as follows:

ln -s $(perl -e 'print "x" x 120') blah
setfattr -n security.selinux -v blahblah -h blah

The symlink is large enough to interfere with the spill block pointer and
has a typical SA registration as follows (shown in modified "zdb -dddd"
<SA attr layout obj> format):

[ ... ZPL_DACL_COUNT ZPL_DACL_ACES ZPL_SYMLINK ]

Adding the SA xattr will attempt to extend the registration to:

[ ... ZPL_DACL_COUNT ZPL_DACL_ACES ZPL_SYMLINK ZPL_DXATTR ]

but since the ZPL_SYMLINK SA interferes with the spill block pointer, it
must also be moved to the spill block which will have a registration of:

[ ZPL_SYMLINK ZPL_DXATTR ]

This commit updates extra_hdrsize when this condition occurs, allowing
hdrsize to be subsequently decreased appropriately.

Signed-off-by: Tim Chase <tim@chase2k.com>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ned Bass <bass6@llnl.gov>
Issue #2214
Issue #2228
Issue #2316
Issue #2343
module/zfs/sa.c