summaryrefslogtreecommitdiff
path: root/tests/btrfs/180
blob: 59bb3c83d68cd435a6084e94fda8b79bbc188f5a (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
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0
# Copyright (C) 2019 SUSE Linux Products GmbH. All Rights Reserved.
#
# FS QA Test 180
#
# Test if btrfs hits EDQUOT without reclaiming already freed extents when quota
# is enabled.
#
# This bug is going to be fxied by a patch for kernel titled
# "btrfs: qgroup: Make qgroup async transaction commit more aggressive"
#
. ./common/preamble
_begin_fstest auto quick qgroup limit prealloc

. ./common/filter

_supported_fs btrfs
_require_scratch
_require_xfs_io_command falloc

_scratch_mkfs > /dev/null
_scratch_mount

$BTRFS_UTIL_PROG quota enable "$SCRATCH_MNT" > /dev/null
_qgroup_rescan "$SCRATCH_MNT" > /dev/null
$BTRFS_UTIL_PROG qgroup limit -e 1G "$SCRATCH_MNT"

$XFS_IO_PROG -f -c "falloc 0 900M" "$SCRATCH_MNT/padding"

# Commit transaction to reflect the quota usage
sync

rm -f "$SCRATCH_MNT/padding"

# Without the kernel fix, this will trigger EDQUOT.
_pwrite_byte 0xcd 0 512M "$SCRATCH_MNT/real_file" | _filter_xfs_io

# success, all done
status=0
exit