2 # SPDX-License-Identifier: GPL-2.0
3 # Copyright (c) 2011 SGI. All Rights Reserved.
7 # This test exercises an issue in libxcmd where a problem with any
8 # mount point or project quota directory causes the program to exit
9 # complete. The effect of this is that one cannot operate on any
10 # directory, even if the problem directory is completely unrelated
11 # to the directory one wants to operate on.
14 seqres=$RESULT_DIR/$seq
15 echo "QA output created by ${seq}"
22 mtab=/proc/self/mounts
24 status=1 # failure is the default!
25 trap "_cleanup; exit \$status" 0 1 2 3 15
33 # get standard environment, filters and checks
38 echo "Silence is golden."
41 # real QA test starts here
43 # Modify as appropriate.
50 _scratch_mkfs >> $seqres.full 2>&1
52 # Just use the current mount table as an example mtab file. Odds
53 # are good there's nothing wrong with it.
55 cp "${mtab}" "${my_mtab}"
58 # Any bogus entry in the mtab file is enough to trigger the problem.
59 # So just append a bogus entry at the end of the private mtab file.
60 # This matches an actually-observed entry in a mount table (with a
61 # few characters in the paths changed to protect the innocent).
63 cat <<-! >> "${my_mtab}"
64 /dev/disk/by-id/scsi-3600508e000000000c329ba1d8b0c391b-part3 /tmp/autoY8qcJ9\040(deleted) xfs rw 0 0
70 export MOUNT_OPTIONS=""
71 elif [ $# -eq 1 ]; then
72 [ $1 = u -o $1 = g -o $1 = p ] || exit
73 export MOUNT_OPTIONS="-o${1}quota"
80 # Set up a private mount table file, then try out a simple quota
81 # command to show mounts
83 echo print | xfs_quota -t "${my_mtab}" > /dev/null || exit
85 # Do the same simple quota command after adding a bogus entry to the
86 # mount table. Old code will bail on this because it has trouble
87 # with the bogus entry.
89 echo print | xfs_quota -t "${my_mtab}" > /dev/null || exit
94 # Mount SCRATCH with no quota options
100 # group quota enabled
106 status=0 # success, all done