summaryrefslogtreecommitdiff
path: root/tests/generic/639
blob: abb91c802a11ca5093973dad2481e30a98191141 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2021, Jeff Layton <jlayton@redhat.com>
#
# FS QA Test No. 639
#
# Open a file and write a little data to it. Unmount (to clean out the cache)
# and then mount again. Then write some data to it beyond the EOF and ensure
# the result is correct.
#
# Prompted by a bug in ceph_write_begin that was fixed by commit 827a746f405d.
#
. ./common/preamble
_begin_fstest auto quick rw

# Import common functions.
. ./common/filter

# real QA test starts here
_supported_fs generic
_require_test

testfile="$TEST_DIR/test_write_begin.$$"

# write some data to file and fsync it out
$XFS_IO_PROG -f -c "pwrite -q 0 32" $testfile

# cycle the mount to clean out the pagecache
_test_cycle_mount

# now, write to the file (near the end)
$XFS_IO_PROG -c "pwrite -q 32 32" $testfile

# dump what we think is in there
echo "The result should be 64 bytes filled with 0xcd:"
_hexdump $testfile

status=0
exit