generic: test MADV_POPULATE_READ with IO errors
[xfstests-dev.git] / tests / generic / 294
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2012 Red Hat, Inc.  All Rights Reserved.
4 #
5 # FS QA Test No. 294
6 #
7 # Tests for EEXIST (not EROFS) for inode creations, if
8 # we ask to create an already-existing entity on an RO filesystem
9 #
10 . ./common/preamble
11 _begin_fstest auto quick
12
13 # Import common functions.
14 . ./common/filter
15
16 # real QA test starts here
17
18 # NFS will optimize away the on-the-wire lookup before attempting to
19 # create a new file (since that means an extra round trip).
20 _supported_fs ^nfs
21
22 _require_scratch
23 _require_symlinks
24 _require_mknod
25
26 _scratch_mkfs > $seqres.full 2>&1 || _fail "Could not mkfs scratch device"
27
28 THIS_TEST_DIR=$SCRATCH_MNT/$seq.test
29
30 _create_files()
31 {
32         mknod $THIS_TEST_DIR/testnode c 1 3 2>&1 | _filter_mknod
33         mkdir $THIS_TEST_DIR/testdir
34         touch $THIS_TEST_DIR/testtarget
35         ln -s $THIS_TEST_DIR/testtarget $THIS_TEST_DIR/testlink 2>&1 | _filter_ln
36 }
37
38 _scratch_mount
39
40 rm -rf $THIS_TEST_DIR
41 mkdir $THIS_TEST_DIR || _fail "Could not create dir for test"
42
43 _create_files 2>&1 | _filter_scratch
44 _try_scratch_mount -o remount,ro || _fail "Could not remount scratch readonly"
45 _create_files 2>&1 | _filter_scratch
46
47 # success, all done
48 status=0
49 exit