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 _begin_fstest auto quick quota
18 mtab=/proc/self/mounts
20 # Override the default cleanup function.
27 # Import common functions.
31 echo "Silence is golden."
33 # real QA test starts here
35 # Modify as appropriate.
41 _scratch_mkfs >> $seqres.full 2>&1
43 # Just use the current mount table as an example mtab file. Odds
44 # are good there's nothing wrong with it.
46 cp "${mtab}" "${my_mtab}"
49 # Any bogus entry in the mtab file is enough to trigger the problem.
50 # So just append a bogus entry at the end of the private mtab file.
51 # This matches an actually-observed entry in a mount table (with a
52 # few characters in the paths changed to protect the innocent).
54 cat <<-! >> "${my_mtab}"
55 /dev/disk/by-id/scsi-3600508e000000000c329ba1d8b0c391b-part3 /tmp/autoY8qcJ9\040(deleted) xfs rw 0 0
61 export MOUNT_OPTIONS=""
62 elif [ $# -eq 1 ]; then
63 [ $1 = u -o $1 = g -o $1 = p ] || exit
64 export MOUNT_OPTIONS="-o${1}quota"
71 # Set up a private mount table file, then try out a simple quota
72 # command to show mounts
74 echo print | $XFS_QUOTA_PROG -t "${my_mtab}" > /dev/null || exit
76 # Do the same simple quota command after adding a bogus entry to the
77 # mount table. Old code will bail on this because it has trouble
78 # with the bogus entry.
80 echo print | $XFS_QUOTA_PROG -t "${my_mtab}" > /dev/null || exit
85 # Mount SCRATCH with no quota options
97 status=0 # success, all done