2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (C) 2018 SUSE Linux Products GmbH. All Rights Reserved.
7 # Test that xattrs are not lost after calling fsync multiple times with a
8 # filesystem commit in between the fsync calls.
11 _begin_fstest auto quick attr log
13 # Override the default cleanup function.
21 # Import common functions.
26 # real QA test starts here
29 _require_dm_target flakey
32 _scratch_mkfs >>$seqres.full 2>&1
33 _require_metadata_journaling $SCRATCH_DEV
37 touch $SCRATCH_MNT/foobar
38 $SETFATTR_PROG -n user.xa1 -v qwerty $SCRATCH_MNT/foobar
39 $SETFATTR_PROG -n user.xa2 -v 'hello world' $SCRATCH_MNT/foobar
40 $SETFATTR_PROG -n user.xa3 -v test $SCRATCH_MNT/foobar
41 $XFS_IO_PROG -c "fsync" $SCRATCH_MNT/foobar
43 # Call sync to commit all fileystem metadata.
46 $XFS_IO_PROG -c "pwrite -S 0xea 0 64K" \
48 $SCRATCH_MNT/foobar >>$seqres.full
50 # Simulate a power failure and mount the filesystem to check that the xattrs
51 # were not lost and neither was the data we wrote.
52 _flakey_drop_and_remount
53 echo "File xattrs after power failure:"
54 _getfattr --absolute-names --dump $SCRATCH_MNT/foobar | _filter_scratch
55 echo "File data after power failure:"
56 od -t x1 $SCRATCH_MNT/foobar