2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat, Inc. All Rights Reserved.
7 # Test orphan inode / unlinked list processing on RO mount & RW transition
9 # A filesystem that crashes with open but unlinked inodes should
10 # be consistent after a ro, ro->rw, or rw mount cycle.
13 seqres=$RESULT_DIR/$seq
14 echo "QA output created by $seq"
18 status=1 # failure is the default!
19 trap "_cleanup; exit \$status" 0 1 2 3 15
27 # get standard environment, filters and checks
31 # remove previous $seqres.full before test
34 # real QA test starts here
37 _require_scratch_shutdown
38 _require_metadata_journaling $SCRATCH_DEV
39 _require_test_program "multi_open_unlink"
42 function create_dirty_orphans() {
50 # sleep for ages and we will kill this pid when we are ready
53 echo "open and unlink $num_files files with EAs"
54 $here/src/multi_open_unlink -f $SCRATCH_MNT/test_file \
55 -n $num_files -s $delay -e $num_eas -v $ea_val_size &
58 # time to create and unlink all the files
62 _scratch_shutdown -v -f >> $seqres.full
64 # kill the multi_open_unlink
72 # Does a regular rw mount handle the orphan list?
73 echo "mount dirty orphans rw, then unmount"
77 # We should be clean at this point
78 echo "check fs consistency"
81 # Does a ro mount handle the orphan list?
82 echo "mount dirty orphans ro, then unmount"
86 # We should be clean at this point
87 echo "check fs consistency"
90 # Does a mount with ro->rw transition handle orphan list?
91 echo "mount dirty orphans ro and remount rw, then unmount"
96 # We should be clean at this point
97 echo "check fs consistency"