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.
49 _scratch_mkfs >> $seqres.full 2>&1
51 # Just use the current mount table as an example mtab file. Odds
52 # are good there's nothing wrong with it.
54 cp "${mtab}" "${my_mtab}"
57 # Any bogus entry in the mtab file is enough to trigger the problem.
58 # So just append a bogus entry at the end of the private mtab file.
59 # This matches an actually-observed entry in a mount table (with a
60 # few characters in the paths changed to protect the innocent).
62 cat <<-! >> "${my_mtab}"
63 /dev/disk/by-id/scsi-3600508e000000000c329ba1d8b0c391b-part3 /tmp/autoY8qcJ9\040(deleted) xfs rw 0 0
69 export MOUNT_OPTIONS=""
70 elif [ $# -eq 1 ]; then
71 [ $1 = u -o $1 = g -o $1 = p ] || exit
72 export MOUNT_OPTIONS="-o${1}quota"
79 # Set up a private mount table file, then try out a simple quota
80 # command to show mounts
82 echo print | xfs_quota -t "${my_mtab}" > /dev/null || exit
84 # Do the same simple quota command after adding a bogus entry to the
85 # mount table. Old code will bail on this because it has trouble
86 # with the bogus entry.
88 echo print | xfs_quota -t "${my_mtab}" > /dev/null || exit
93 # Mount SCRATCH with no quota options
105 status=0 # success, all done