xfs/{263,106}: erase max warnings printout
[xfstests-dev.git] / tests / generic / 462
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2017 Red Hat.  All Rights Reserved.
4 #
5 # FS QA Test 462
6 #
7 # This is a regression test for kernel commit
8 #  ef947b2 x86, mm: fix gup_pte_range() vs DAX mappings
9 # created by Jeffrey Moyer <jmoyer@redhat.com>
10 #
11 # This is reproducible only when testing on pmem device
12 # which is configured in "memory mode", not in "raw mode".
13 #
14 seq=`basename $0`
15 seqres=$RESULT_DIR/$seq
16 echo "QA output created by $seq"
17
18 here=`pwd`
19 tmp=/tmp/$$
20 status=1        # failure is the default!
21 trap "_cleanup; exit \$status" 0 1 2 3 15
22
23 _cleanup()
24 {
25         cd /
26         rm -rf $tmp.*
27 }
28
29 # get standard environment, filters and checks
30 . ./common/rc
31 . ./common/filter
32
33 # remove previous $seqres.full before test
34 rm -f $seqres.full
35
36 # Modify as appropriate.
37 _supported_fs generic
38 _supported_os Linux
39 _require_test
40 _require_scratch_dax
41 _require_test_program "t_mmap_write_ro"
42 # running by unpriviliged user is not necessary to reproduce
43 # this bug, just trying to test more.
44 _require_user
45
46 # real QA test starts here
47
48 _scratch_mkfs >>$seqres.full 2>&1
49 _scratch_mount "-o dax"
50
51 # remount TEST_DEV wo/ dax
52 export TEST_FS_MOUNT_OPTS=""
53 _test_cycle_mount
54
55 # prepare a 4k read-only DAX file, save its md5sum
56 $XFS_IO_PROG -f -c "pwrite -S 0xFF 0 4096" \
57         $SCRATCH_MNT/readonlyfile >> $seqres.full 2>&1
58 chmod 0644  $SCRATCH_MNT/readonlyfile
59 md5_1="$(_md5_checksum $SCRATCH_MNT/readonlyfile)"
60
61 # prepare another 4k non-DAX file
62 $XFS_IO_PROG -f -c "pwrite -S 0x00 0 4096" \
63         $TEST_DIR/${seq}.file >> $seqres.full 2>&1
64
65 # allow qa_user access
66 chown $qa_user $TEST_DIR/${seq}.file
67
68 # run test programme, read another file writing into
69 # the read-only file with mmap, which should fail.
70 #
71 # don't use $here/src/t_mmap_write_ro, as we're running it as a regular user,
72 # and $here may contain path component that a regular user doesn't have search
73 # permission
74 _user_do "src/t_mmap_write_ro $TEST_DIR/${seq}.file \
75         $SCRATCH_MNT/readonlyfile"
76
77 # read-only file should not get updated, md5sum again.
78 md5_2="$(_md5_checksum $SCRATCH_MNT/readonlyfile)"
79
80 [ "$md5_1" != "$md5_2" ] && echo "read only file changed"
81
82 # success, all done
83 status=0
84 exit