aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Disseldorp <ddiss@suse.de>2022-04-13 18:44:21 +0200
committerEryu Guan <guaneryu@gmail.com>2022-04-17 20:08:31 +0800
commita59e1f79f4e553b244957527e7a66f5cb2a618e7 (patch)
tree66a3dbe7f12b1025b3ecbf9149dee1b749b6b9e9
parentdc76e4ec19a8e9da6366cf75d86e063409a385c1 (diff)
downloadxfstests-dev-a59e1f79f4e553b244957527e7a66f5cb2a618e7.tar.gz
generic/020: fix max_attrval_size for XFS, UDF, Btrfs and NFS
As found by Dave Chinner, fff4359d ("020: make this xattr test generic") unintentionally changed the long attribute value length from 100K to 64 *bytes* for XFS, UDF and Btrfs. Update XFS and UDF to use a 64K $max_attrval_size value. For Btrfs, use the nodesize, xattr length and tree entry overhead sizes to calculate the maximum. NFS doesn't provide a way to find out the $max_attrval_size for the underlying filesystem on the server, so just use a rough 1K limit. Signed-off-by: David Disseldorp <ddiss@suse.de> Reviewed-by: Eryu Guan <guaneryu@gmail.com> Signed-off-by: Eryu Guan <guaneryu@gmail.com>
-rwxr-xr-xtests/generic/02020
1 files changed, 16 insertions, 4 deletions
diff --git a/tests/generic/020 b/tests/generic/020
index cbd3f22739..f50a4f8758 100755
--- a/tests/generic/020
+++ b/tests/generic/020
@@ -113,20 +113,32 @@ _attr_get_max()
let max_attrs=$BLOCK_SIZE/40
esac
- # Set max attr value size based on fs type
+ # Set max attr value size in bytes based on fs type
case "$FSTYP" in
- xfs|udf|btrfs)
- max_attrval_size=64
+ btrfs)
+ _require_btrfs_command inspect-internal dump-super
+ local ns=$($BTRFS_UTIL_PROG inspect-internal dump-super \
+ $TEST_DEV | sed -n 's/nodesize\s*\(.*\)/\1/p')
+ [ -n "$ns" ] || _fail "failed to obtain nodesize"
+ # max == nodesize - sizeof(struct btrfs_header)
+ # - sizeof(struct btrfs_item)
+ # - sizeof(struct btrfs_dir_item) - name_len
+ max_attrval_size=$(( $ns - 156 - $max_attrval_namelen ))
;;
pvfs2)
max_attrval_size=8192
;;
- 9p|ceph|nfs)
+ xfs|udf|9p|ceph)
max_attrval_size=65536
;;
bcachefs)
max_attrval_size=1024
;;
+ nfs)
+ # NFS doesn't provide a way to find out the max_attrval_size for
+ # the underlying filesystem, so just use the lowest value above.
+ max_attrval_size=1024
+ ;;
*)
# Assume max ~1 block of attrs
BLOCK_SIZE=`_get_block_size $TEST_DIR`