generic/233,270: unlimit the max locked memory size for io_uring
[xfstests-dev.git] / tests / ext4 / 039
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. ext4/039
6 #
7 # Test data journaling flag switch for a single file  
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1        # failure is the default!
16 trap "rm -f $tmp.*; exit \$status" 0 1 2 3 15
17
18 # ext3 and ext4 don't support direct IO in journalling mode
19 write_opt_list="iflag=noatime conv=notrunc conv=fsync"
20
21 # get standard environment, filters and checks
22 . ./common/rc
23 . ./common/filter
24 _workout()
25 {
26         echo "Switch data journalling mode. Silence is golden."
27         chattr_opt_list="+j -j +jS -j"
28         idx=0
29         #
30         for write_opt in $write_opt_list
31         do
32                 idx=$((idx + 1))
33                 for chattr_opt in $chattr_opt_list
34                 do
35                     
36                         echo "OP write_opt: $write_opt 4M, \
37 chattr_opt: $chattr_opt" >>$seqres.full
38                         dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
39                                 bs=1M count=4 $write_opt \
40                                 >> $seqres.full 2>&1 || exit
41                         $CHATTR_PROG $chattr_opt $SCRATCH_MNT/file.$idx >> $seqres.full \
42                                 || exit
43                 done
44         done
45         sync
46         # Same as previous test, but for one file,
47         # and with ENOSPC triggering
48         for write_opt in $write_opt_list
49         do
50                 idx=$((idx + 1))
51                 for chattr_opt in $chattr_opt_list
52                 do
53
54                         echo "OP write_opt: $write_opt ENOSPC, \
55 chattr_opt: $chattr_opt" >>$seqres.full
56                         dd if=/dev/zero of=$SCRATCH_MNT/file.$idx \
57                                 bs=1M $write_opt >> $seqres.full 2>&1
58                         $CHATTR_PROG $chattr_opt $SCRATCH_MNT/file.$idx \
59                                 >> $seqres.full || exit
60                 done
61                 sync
62                 unlink $SCRATCH_MNT/file.$idx
63         done
64 }
65
66 # real QA test starts here
67 _supported_fs ext3 ext4
68 _require_scratch
69 _exclude_scratch_mount_option dax
70
71 rm -f $seqres.full
72 _scratch_mkfs_sized $((64 * 1024 * 1024)) >> $seqres.full 2>&1
73 _scratch_mount
74
75 if ! _workout; then
76         echo "workout failed"
77         _scratch_unmount
78         status=1
79         exit
80 fi
81
82 if ! _scratch_unmount; then
83         echo "failed to umount"
84         status=1
85         exit
86 fi
87 echo "Check filesystem"
88 status=0
89 exit