blob: 7b6e5570ba4e014ea5d322102968293d3c3a0bbc (
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
|
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (c) 2022 Red Hat, Inc. All Rights Reserved.
#
# FS QA Test No. 705
#
# Test an issue in the truncate codepath where on-disk inode sizes are logged
# prematurely via the free eofblocks path on file close.
#
. ./common/preamble
_begin_fstest auto shutdown
# real QA test starts here
_supported_fs generic
_require_scratch
_require_scratch_shutdown
_require_command "$FILEFRAG_PROG" filefrag
_scratch_mkfs > $seqres.full 2>&1
_scratch_mount
echo "Create many small files with one extent at least"
for ((i=0; i<10000; i++));do
$XFS_IO_PROG -f -c "pwrite 0 4k" $SCRATCH_MNT/file.$i >/dev/null 2>&1
done
echo "Shutdown the fs suddently"
_scratch_shutdown
echo "Cycle mount"
_scratch_cycle_mount
echo "Check file's (di_size > 0) extents"
for f in $(find $SCRATCH_MNT -type f -size +0);do
# Check if the file has any extent
$FILEFRAG_PROG -v $f > $tmp.filefrag
if grep -Eq ': 0 extents found' $tmp.filefrag;then
echo " - $f get no extents, but its di_size > 0"
cat $tmp.filefrag
break
fi
done
# success, all done
status=0
exit
|