#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
+#
# FS QA Test No. 062
#
# Exercises the getfattr/setfattr tools
# Derived from tests originally written by Andreas Gruenbacher for ext2
#
-#-----------------------------------------------------------------------
-# Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved.
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it would be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-#
-#-----------------------------------------------------------------------
-#
-
seq=`basename $0`
seqres=$RESULT_DIR/$seq
echo "QA output created by $seq"
{
cd /
echo; echo "*** unmount"
- umount $SCRATCH_MNT 2>/dev/null
+ _scratch_unmount 2>/dev/null
rm -f $tmp.*
}
trap "_cleanup; exit \$status" 0 1 2 3 15
getfattr()
{
- $GETFATTR_PROG --absolute-names -dh $@ 2>&1 | _filter_scratch
+ _getfattr --absolute-names -dh $@ 2>&1 | _filter_scratch
}
setfattr()
ln -s $SCRATCH_MNT/dir $SCRATCH_MNT/lnk
mkdir $SCRATCH_MNT/dev
mknod $SCRATCH_MNT/dev/b b 0 0
- mknod $SCRATCH_MNT/dev/c c 0 0
+ mknod $SCRATCH_MNT/dev/c c 1 3
mknod $SCRATCH_MNT/dev/p p
# sanity check
find $SCRATCH_MNT | LC_COLLATE=POSIX sort | _filter_scratch | grep -v "lost+found"
_require_scratch
_require_attrs
+_require_symlinks
rm -f $tmp.backup1 $tmp.backup2 $seqres.full
# real QA test starts here
_scratch_mkfs > /dev/null 2>&1 || _fail "mkfs failed"
-_scratch_mount || _fail "mount failed"
+_scratch_mount
_create_test_bed
# In kernels before 3.0, getxattr() fails with EPERM for an attribute which
_backup()
{
- # NB: no filtering of scratch here... (need to restore too)
- $GETFATTR_PROG --absolute-names -dh -R -m '.' $SCRATCH_MNT >$1
+ # Note: we don't filter scratch here since we need to restore too. But
+ # we *do* sort the output by path, since it otherwise would depend on
+ # readdir order, which on some filesystems may change after re-creating
+ # the files.
+ _getfattr --absolute-names -dh -R -m '.' $SCRATCH_MNT | _sort_getfattr_output >$1
echo BACKUP $1 >>$seqres.full
cat $1 >> $seqres.full
[ ! -s $1 ] && echo "warning: $1 (backup file) is empty"
_backup $tmp.backup1
echo "*** clear out the scratch device"
-rm -fr $SCRATCH_MNT/*
+rm -rf $(find $SCRATCH_MNT/* | grep -v "lost+found")
echo "AFTER REMOVE" >>$seqres.full
getfattr -L -R -m '.' $SCRATCH_MNT >>$seqres.full