summaryrefslogtreecommitdiff
path: root/tests/generic/710
blob: c7fca05d4c0ef2e9507d770054c5710fda658ff3 (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
50
51
52
53
#! /bin/bash
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2022 Oracle.  All Rights Reserved.
#
# FS QA Test No. 710
#
# Can we use swapext to exceed the quota enforcement?

. ./common/preamble
_begin_fstest auto quick fiexchange swapext quota

# Import common functions.
. ./common/filter
. ./common/quota

# real QA test starts here
_require_xfs_io_command swapext '-v exchrange'
_require_user
_require_nobody
_require_quota
_require_xfs_quota
_require_scratch

# Format filesystem and set up quota limits
_scratch_mkfs > $seqres.full
_qmount_option "usrquota,grpquota"
_qmount >> $seqres.full

# Set up initial files
$XFS_IO_PROG -f -c 'pwrite -S 0x58 0 256k -b 1m' $SCRATCH_MNT/a >> $seqres.full
chown $qa_user $SCRATCH_MNT/a
$XFS_IO_PROG -f -c 'pwrite -S 0x59 0 64k -b 64k' -c 'truncate 256k' $SCRATCH_MNT/b >> $seqres.full
chown nobody $SCRATCH_MNT/b

# Set up a quota limit
$XFS_QUOTA_PROG -x -c "limit -u bhard=70k nobody" $SCRATCH_MNT

echo before swapext >> $seqres.full
$XFS_QUOTA_PROG -x -c 'report -a' $SCRATCH_MNT >> $seqres.full
stat $SCRATCH_MNT/* >> $seqres.full

# Now try to swapext
$XFS_IO_PROG -c "swapext $SCRATCH_MNT/b" $SCRATCH_MNT/a

echo after swapext >> $seqres.full
$XFS_QUOTA_PROG -x -c 'report -a' $SCRATCH_MNT >> $seqres.full
stat $SCRATCH_MNT/* >> $seqres.full

_check_quota_usage

# success, all done
status=0
exit