Limit the maximum xattr size returned to userspace from the MDS to
what the currently-running kernel supports (XATTR_SIZE_MAX=65536
bytes typically). While it is possible a Lustre backing filesystem
may store larger xattrs than this, it wouldn't be possible for users
to access a larger xattr via kernel xattr interfaces.
This fixes interop problems when newer clients and tests are running
against older servers:
sanity.sh: line 8946: /usr/bin/setfattr: Argument list too long
Skip subtests for new features in 2.13 so 2.12 interop testing passes.
Fix test-framework.sh::large_xattr_enabled() to return true for ZFS.
Fix test-framework.sh::max_xattr_size() to return the actual value
returned from the MDS rather than computing it locally.
Fixes:
3ec712bd183 ("LU-11868 osd: Set max ea size to XATTR_SIZE_MAX")
Test-Parameters: trivial serverversion=2.12 testlist=sanity
Test-Parameters: serverversion=2.12 testlist=conf-sanity envdefinitions=ONLY=81
Test-Parameters: testlist=sanity-pfl,replay-single
Test-Parameters: testlist=conf-sanity envdefinitions=ONLY=48,61,81
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I14232809b13886efa8f11a50ecc35e78f316810d
Reviewed-on: https://review.whamcloud.com/36240
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Wang Shilong <wshilong@ddn.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
if (rc)
return rc;
- return sprintf(buf, "%u\n", ealen);
+ /* Limit xattr size returned to userspace based on kernel maximum */
+ return snprintf(buf, PAGE_SIZE, "%u\n",
+ ealen > XATTR_SIZE_MAX ? XATTR_SIZE_MAX : ealen);
}
LUSTRE_RO_ATTR(max_easize);
if (rc)
return rc;
- return sprintf(buf, "%u\n", ealen);
+ /* Limit xattr size returned to userspace based on kernel maximum */
+ return snprintf(buf, PAGE_SIZE, "%u\n",
+ ealen > XATTR_SIZE_MAX ? XATTR_SIZE_MAX : ealen);
}
/**
# LOV EA, and so on. These EA will use some EA space that is shared by
# ACL entries. So here we only check some reasonable ACL entries count,
# instead of the max number that is calculated from the max_ea_size.
- if [ "$MDS1_VERSION" -lt $(version_code 2.8.57) ];
- then
+ if [ "$MDS1_VERSION" -lt $(version_code 2.8.57) ]; then
count=28 # hard coded of RPC protocol
- elif [ "$mds1_FSTYPE" != ldiskfs ]; then
- count=4000 # max_num 4091 max_ea_size = ~65536
- elif ! large_xattr_enabled; then
- count=450 # max_num 497 max_ea_size = 4012
- else
+ elif large_xattr_enabled; then
count=4500 # max_num 8187 max_ea_size = 65452
- # not create too much (>5000) to save test time
+ # not create too many (4500) to save test time
+ else
+ count=450 # max_num 497 max_ea_size = 4012
fi
echo "It is expected to hold at least $count ACL entries"
# Check max_easize.
local max_easize=$($LCTL get_param -n llite.*.max_easize)
- if [ $MDS1_VERSION -lt $(version_code 2.12.51) ]
- then
- [[ $max_easize -eq 128 ]] ||
- error "max_easize is $max_easize, should be 128 bytes"
+ # 65452 is XATTR_SIZE_MAX less ldiskfs ea overhead
+ if large_xattr_enabled; then
+ [[ $max_easize -ge 65452 ]] ||
+ error "max_easize is $max_easize, should be at least 65452 bytes"
else
# LU-11868
- # 4012 is 4096 - ldiskfs ea overhead
+ # 4012 is 4096 less ldiskfs ea overhead
[[ $max_easize -ge 4012 ]] ||
- error "max_easize is $max_easize, should be at least 4012 bytes"
-
- # 65452 is XATTR_SIZE_MAX - ldiskfs ea overhead
- if large_xattr_enabled;
- then
- [[ $max_easize -ge 65452 ]] ||
- error "max_easize is $max_easize, should be at least 65452 bytes"
- fi
+ error "max_easize is $max_easize, should be at least 4012 bytes"
fi
restore_ostindex
test_204d() {
[ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
[ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
- skip "skipped for lustre < $SEL_VERSION"
+ skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
local found=""
test_204e() {
[ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
[ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
- skip "skipped for lustre < $SEL_VERSION"
+ skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
local found=""
test_204f() {
[ $OSTCOUNT -lt 2 ] && skip "needs >= 2 OSTs"
[ "$MDS1_VERSION" -lt $(version_code $SEL_VER) ] &&
- skip "skipped for lustre < $SEL_VERSION"
+ skip "skipped for lustre < $SEL_VER"
local comp_file=$DIR/$tdir/$tfile
local found=""
[ $MDS1_VERSION -lt $(version_code 2.9.55) ] ||
[ $CLIENT_VERSION -lt $(version_code 2.9.55) ] &&
skip27D+=" -s 30,31"
- [ $(lustre_version_code $SINGLEMDS) -lt $(version_code $SEL_VER) ] &&
- skip27D+="-s 32"
[[ ! $($LCTL get_param mdc.*.import) =~ connect_flags.*overstriping ||
$OSTCOUNT -ge $(($LOV_MAX_STRIPE_COUNT / 2)) ]] &&
skip27D+=" -s 32,33"
+ [[ $MDS_VERSION -lt $(version_code $SEL_VER) ]] &&
+ skip27D+=" -s 34"
llapi_layout_test -d$DIR/$tdir -p$POOL -o$OSTCOUNT $skip27D ||
error "llapi_layout_test failed"
test_27I() {
[ $PARALLEL == "yes" ] && skip "skip parallel run"
[[ $OSTCOUNT -lt 2 ]] && skip_env "needs >= 2 OSTs"
+ [[ $MDS1_VERSION -gt $(version_code 2.12.52) ]] ||
+ skip "Need MDS version newer than 2.12.52"
local pool=$TESTNAME
local ostrange="1 1 1"
run_test 56r "check lfs find -size works"
test_56ra() {
+ [[ $MDS1_VERSION -gt $(version_code 2.12.58) ]] ||
+ skip "MDS < 2.12.58 doesn't return LSOM data"
local dir=$DIR/$tdir
[[ $OSC == "mdc" ]] && skip "DoM files" && return
test_810() {
[ $PARALLEL == "yes" ] && skip "skip parallel run"
$GSS && skip_env "could not run with gss"
+ [[ $OST1_VERSION -gt $(version_code 2.12.58) ]] ||
+ skip "OST < 2.12.58 doesn't align checksum"
set_checksums 1
stack_trap "set_checksums $ORIG_CSUM" EXIT
# ldiskfs xattrs over one block in size. Allow both the historical
# Lustre feature name (large_xattr) and the upstream name (ea_inode).
large_xattr_enabled() {
- [[ $(facet_fstype $SINGLEMDS) == zfs ]] && return 0
+ [[ $(facet_fstype $SINGLEMDS) == zfs ]] && return 1
local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
# Get the maximum xattr size supported by the filesystem.
max_xattr_size() {
- local size
-
- if large_xattr_enabled; then
- size=$($LCTL get_param -n llite.*.max_easize)
- else
- local mds_dev=$(mdsdevname ${SINGLEMDS//mds/})
- local block_size=$(get_block_size $SINGLEMDS $mds_dev)
-
- # maximum xattr size = size of block - size of header -
- # size of 1 entry - 4 null bytes
- size=$((block_size - 32 - 32 - 4))
- fi
-
- echo $size
+ $LCTL get_param -n llite.*.max_easize
}
# Dump the value of the named xattr from a file.
error "No component starting at zero(!)"
}
-#TODO: This version is a placeholder, to be replaced before final commit
-SEL_VER="2.12.52"
+# version after which Self-Extending Layouts are available
+SEL_VER="2.12.55"
sel_layout_sanity() {
local file=$1