f4158bb37f233de2aa313d1ed929d430a7001962
[xfstests-dev.git] / tests / generic / 611
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2020 Red Hat, Inc. All Rights Reserved.
4 #
5 # FS QA Test 611
6 #
7 # Verify that metadata won't get corrupted when extended attribute
8 # name of size one is set.
9 #
10 # This test verifies the problem fixed in kernel with commit
11 # f4020438fab0 ("xfs: fix boundary test in xfs_attr_shortform_verify")
12
13 seq=`basename $0`
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by $seq"
16
17 here=`pwd`
18 tmp=/tmp/$$
19 status=1        # failure is the default!
20 trap "_cleanup; exit \$status" 0 1 2 3 15
21
22 _cleanup()
23 {
24         cd /
25         rm -f $tmp.*
26 }
27
28 # get standard environment, filters and checks
29 . ./common/rc
30 . ./common/filter
31 . ./common/attr
32
33 # remove previous $seqres.full before test
34 rm -f $seqres.full
35
36 # real QA test starts here
37
38 _supported_fs generic
39 _require_scratch
40 _require_attrs
41
42 _scratch_mkfs > $seqres.full 2>&1
43 _scratch_mount
44
45 localfile="${SCRATCH_MNT}/testfile"
46
47 touch "${localfile}"
48 "${SETFATTR_PROG}" -n user.a "${localfile}"
49
50 # Make sure that changes are written to disk
51 _scratch_cycle_mount
52
53 # If the target bug isn't fixed, getfattr fails
54 ${GETFATTR_PROG} --absolute-names -n user.a $localfile | grep 'user.a'
55
56 status=0
57 exit