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