xfs: test fallocate ops when rt extent size is and isn't a power of 2
[xfstests-dev.git] / tests / xfs / 162
1 #! /bin/bash
2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2006 Silicon Graphics, Inc.  All Rights Reserved.
4 #
5 # FSQA Test No. 162
6 #
7 # Placing holds on objects
8 #
9 seq=`basename $0`
10 seqres=$RESULT_DIR/$seq
11 echo "QA output created by $seq"
12
13 here=`pwd`
14 tmp=/tmp/$$
15 status=1    # failure is the default!
16 trap "exit \$status" 0 1 2 3 15
17
18 # get standard environment, filters and checks
19 . ./common/rc
20 . ./common/filter
21 . ./common/dmapi
22
23 # real QA test starts here
24 _supported_fs xfs
25
26 _require_scratch
27 _scratch_mkfs_xfs >/dev/null 2>&1
28 _dmapi_scratch_mount
29
30 qa_file=$SCRATCH_MNT/dmapi_hole_file
31 touch $qa_file
32
33 echo "***create session"
34 eval `${DMAPI_QASUITE1_DIR}../simple/dm_create_session`
35
36 echo "***create user event"
37 token="`${DMAPI_QASUITE1_DIR}cmd/create_userevent -s $newsid OBJECT_HOLD_EVENT | perl -ne 'if (/token ([0-9]+)/) { print $1; } '`"
38 [ $? -ne 0 ] && echo "failed to create user event"
39
40 echo "***check hold"
41 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_query -s $newsid $token $qa_file
42 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_hold -s $newsid $token $qa_file
43 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_query -s $newsid $token $qa_file
44
45 echo "***check holding an object thats already held"
46 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_hold -s $newsid $token $qa_file 2>/dev/null
47 [ $? -eq 0 ] && echo "obj_ref_hold should have failed"
48
49 echo "***release object"
50 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_rele -s $newsid $token $qa_file
51 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_query -s $newsid $token $qa_file
52
53 echo "***release object with no hold"
54 ${DMAPI_QASUITE1_DIR}cmd/obj_ref_rele -s $newsid $token $qa_file 2>/dev/null
55 [ $? -eq 0 ] && echo "obj_ref_rele should have failed"
56
57 echo "***respond to user event"
58 ${DMAPI_QASUITE1_DIR}cmd/respond_event $newsid $token 1 0
59 [ $? -ne 0 ] && echo "1st respond_event failed."
60
61 ${DMAPI_QASUITE1_DIR}../simple/dm_destroy_session -s $newsid
62
63 status=0
64 exit