summaryrefslogtreecommitdiff
path: root/tests/xfs/519
blob: 49c62b56f6b52708ce4a4348a11628384048d6f8 (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
40
41
42
43
44
45
46
47
48
49
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2020, Oracle and/or its affiliates.  All Rights Reserved.
#
# FS QA Test No. 519
#
# Make sure that reflink forces the log out if we mount with wsync.  We test
# that it actually forced the log by immediately shutting down the fs without
# flushing the log and then remounting to check file contents.

. ./common/preamble
_begin_fstest auto quick clone

# Import common functions.
. ./common/filter
. ./common/reflink

# real QA test starts here
_supported_fs xfs
_require_scratch_reflink
_require_cp_reflink

# Format filesystem and set up quota limits
_scratch_mkfs > $seqres.full
_scratch_mount -o wsync >> $seqres.full

# Set up initial files
$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 1m -b 1m' $SCRATCH_MNT/a >> $seqres.full
$XFS_IO_PROG -f -c 'pwrite -S 0x59 0 1m -b 1m' $SCRATCH_MNT/c >> $seqres.full
_cp_reflink $SCRATCH_MNT/a $SCRATCH_MNT/e
_cp_reflink $SCRATCH_MNT/c $SCRATCH_MNT/d
touch $SCRATCH_MNT/b
sync

# Test that setting the reflink flag on the dest file forces the log
echo "test reflink flag not set"
$XFS_IO_PROG -x -c "reflink $SCRATCH_MNT/a" -c 'shutdown' $SCRATCH_MNT/b >> $seqres.full
_scratch_cycle_mount wsync
md5sum $SCRATCH_MNT/a $SCRATCH_MNT/b | _filter_scratch

# Test forcing the log even if both files are already reflinked
echo "test reflink flag already set"
$XFS_IO_PROG -x -c "reflink $SCRATCH_MNT/a" -c 'shutdown' $SCRATCH_MNT/d >> $seqres.full
_scratch_cycle_mount wsync
md5sum $SCRATCH_MNT/a $SCRATCH_MNT/d | _filter_scratch

# success, all done
status=0
exit