fstests: move test group info to test files
[xfstests-dev.git] / tests / xfs / 433
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 433
6 #
7 # Regression test for an XFS NULL xattr buffer problem during unlink. XFS had a
8 # bug where the attr fork walk during file removal could go off the rails due to
9 # a stale reference to content of a released buffer. Memory pressure could cause
10 # this reference to point to free or reused memory and cause subsequent
11 # attribute fork lookups to fail, return a NULL buffer and possibly crash.
12 #
13 # This test emulates this behavior using an error injection knob to explicitly
14 # disable buffer LRU caching. This forces the attr walk to execute under
15 # conditions where each buffer is immediately freed on release.
16 #
17 # Commit f35c5e10c6ed ("xfs: reinit btree pointer on attr tree inactivation
18 # walk") fixed the bug.
19 #
20 . ./common/preamble
21 _begin_fstest auto quick attr
22
23 # Import common functions.
24 . ./common/attr
25 . ./common/inject
26
27 # real QA test starts here
28
29 # Modify as appropriate.
30 _supported_fs generic
31 _require_xfs_io_error_injection buf_lru_ref
32 _require_scratch
33 _require_attrs
34
35 _scratch_mkfs > $seqres.full 2>&1
36 _scratch_mount
37
38 file=$SCRATCH_MNT/testfile
39
40 # create a bunch of xattrs to form a multi-level attr tree
41 touch $file
42 for i in $(seq 0 499); do
43         $SETFATTR_PROG -n trusted.user.$i -v 0 $file
44 done
45
46 # cycle the mount to clear any buffer references
47 _scratch_cycle_mount || _fail "cycle mount failure"
48
49 # disable the lru cache and unlink the file
50 _scratch_inject_error buf_lru_ref 1
51 rm -f $file
52 _scratch_inject_error buf_lru_ref 0
53
54 echo Silence is golden
55
56 # success, all done
57 status=0
58 exit