* [PATCH] btrfs/012: Enable test to be executed on non-4k block size filesystems
From: Chandan Rajendra @ 2016-12-26 17:32 UTC (permalink / raw)
To: fstests, linux-btrfs; +Cc: Chandan Rajendra, quwenruo
To get the test to work on non-4k block sized filesystems, this commit
obtains the block size of the Btrfs filesystem from $TEST_DIR.
Signed-off-by: Chandan Rajendra <chandan@linux.vnet.ibm.com>
---
tests/btrfs/012 | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/tests/btrfs/012 b/tests/btrfs/012
index b39dec0..cbd3882 100755
--- a/tests/btrfs/012
+++ b/tests/btrfs/012
@@ -63,8 +63,10 @@ _require_command "$E2FSCK_PROG" e2fsck
rm -f $seqres.full
+BLOCK_SIZE=`get_block_size $TEST_DIR`
+
# Create & populate an ext4 filesystem
-$MKFS_EXT4_PROG -F -b 4096 $SCRATCH_DEV > $seqres.full 2>&1 || \
+$MKFS_EXT4_PROG -F -b $BLOCK_SIZE $SCRATCH_DEV > $seqres.full 2>&1 || \
_notrun "Could not create ext4 filesystem"
# Manual mount so we don't use -t btrfs or selinux context
mount -t ext4 $SCRATCH_DEV $SCRATCH_MNT
--
2.5.5
^ permalink raw reply related
* [PATCH] fstests: btrfs/132: Use better method to wait the writer to avoid EBUSY
From: Qu Wenruo @ 2016-12-26 4:57 UTC (permalink / raw)
To: linux-btrfs, fstests
The kill and wait method will only wait for the children process to
exit, while the xfs_io can still run at background.
This makes the test always fails on HDD backed physical machine.
Use the "while ps aux | grep" method in btrfs/069 to truely wait the
xfs_io to finish.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
tests/btrfs/132 | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/tests/btrfs/132 b/tests/btrfs/132
index 0516177..db0dcb0 100755
--- a/tests/btrfs/132
+++ b/tests/btrfs/132
@@ -94,9 +94,10 @@ sleep $sleep_time
kill $pids
wait
-# Sync the fs to avoid EBUSY while umount, which is quite common for btrfs
-# compression
-sync
+# Wait all writers really exits
+while ps aux | grep "$SCRATCH_MNT" | grep -qv grep; do
+ sleep 1
+done
echo "Silence is golden"
status=0
--
2.7.4
^ permalink raw reply related
* Re: [PATCH] fstests: btrfs: Test scrub and replace race for RAID56
From: Qu Wenruo @ 2016-12-26 0:23 UTC (permalink / raw)
To: Eryu Guan; +Cc: linux-btrfs, fstests
In-Reply-To: <20161224094525.GR1859@eguan.usersys.redhat.com>
At 12/24/2016 05:45 PM, Eryu Guan wrote:
> On Thu, Dec 22, 2016 at 10:02:51AM +0800, Qu Wenruo wrote:
>> Although by design, btrfs scrub and replace share the same code path, so
>> they are exclusive to each other.
>>
>> But the fact is, there is still some critical region not protected well,
>> so we can have the following kernel panic, especially easy to trigger on
>> RAID5/6 profiles.
>
> Could btrfs/069 reproduce the panic? It also races scrub and replace,
> but with fsstress running in background, raid5/6 profiles are part of
> the default test configs.
Yes, but the possibility is very low and depends on the test machine.
I never reproduced it with btrfs/069 on all my VMs, but can produce it
on my physical machines.
Nor btrfs/069 supports TIME_FACTOR to improve the possibility.
>
> Also, is there a known fix available in Linus tree or btrfs tree? If
> not, I'd push this new test after there's a known fix (if it's worth a
> new test).
Not yet, still WIP.
I'll CC you as the fix is submitted.
Thanks,
Qu
>
> Thanks,
> Eryu
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
>
^ permalink raw reply
* [PATCH v2 3/3] xfs/348: test readlink/readdir with malformed inode mode
From: Amir Goldstein @ 2016-12-25 18:09 UTC (permalink / raw)
To: Eryu Guan, Darrick J . Wong, Christoph Hellwig
Cc: Brian Foster, fstests, linux-xfs
In-Reply-To: <1482689376-23553-1-git-send-email-amir73il@gmail.com>
In addition to testing xfs_repair on inodes with malformed mode,
and fstat of those inodes on a mounted fs, try to also list content
of mock directory and readlink of mock symlink.
Readdir of mock directory triggers XFS assertion on umount:
XFS: Assertion failed: !rwsem_is_locked(&inode->i_rwsem), file:
/home/amir/build/src/linux/fs/xfs/xfs_super.c, line: 951
To reproduce, need to comment out the variable 'safety'.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/xfs/348 | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/tests/xfs/348 b/tests/xfs/348
index 2a54f9e..cb0e3ea 100755
--- a/tests/xfs/348
+++ b/tests/xfs/348
@@ -132,6 +132,16 @@ for dt in $dtypes; do
cat $tmp.stat.err
else
echo "stat: '$testdir/$file' is a $ftype"
+ # Verify that readlink of a file posing as a symlink
+ # and ls of a file posing as a directory does not blow up
+ safety="-d"
+ # NOTE that ls DOES blow up with kernel 4.9 on malformed
+ # directory - remove the safety pin to explode
+ if [ -d $testdir/$file ]; then
+ ls "$safety" $testdir/$file &> /dev/null
+ elif [ -h $testdir/$file ]; then
+ readlink $testdir/$file &> /dev/null
+ fi
fi | _filter_scratch
done
_scratch_unmount
--
2.7.4
^ permalink raw reply related
* [PATCH v2 2/3] xfs/348: test fstat with malformed inode mode
From: Amir Goldstein @ 2016-12-25 18:09 UTC (permalink / raw)
To: Eryu Guan, Darrick J . Wong, Christoph Hellwig
Cc: Brian Foster, fstests, linux-xfs
In-Reply-To: <1482689376-23553-1-git-send-email-amir73il@gmail.com>
In addition to testing xfs_repair on inodes with malformed mode,
also test fstat of those inodes on a mounted fs.
This additional test is quite noisy with dmesg warnings, so
check dmesg has been disabled.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/xfs/348 | 16 ++++++++++
tests/xfs/348.out | 96 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 112 insertions(+)
diff --git a/tests/xfs/348 b/tests/xfs/348
index 9ec696a..2a54f9e 100755
--- a/tests/xfs/348
+++ b/tests/xfs/348
@@ -49,6 +49,10 @@ _supported_fs xfs
_supported_os Linux
_require_scratch
+# This test will corrupt fs intentionally, so there will be WARNINGs
+# in dmesg as expected
+_disable_dmesg_check
+
rm -f $seqres.full
_scratch_mkfs >>$seqres.full 2>&1
@@ -119,6 +123,18 @@ for dt in $dtypes; do
_scratch_xfs_repair -n 2>&1 | grep -q -v "^would fix ftype mismatch" || \
_fail "xfs_repair should not fix ftype mismatch"
fi
+
+ _scratch_mount
+ for file in DIR FILE SYMLINK CHRDEV BLKDEV FIFO; do
+ rm -f $tmp.stat.err
+ ftype=$(stat --printf=%F $testdir/$file 2>$tmp.stat.err)
+ if [ -s $tmp.stat.err ]; then
+ cat $tmp.stat.err
+ else
+ echo "stat: '$testdir/$file' is a $ftype"
+ fi | _filter_scratch
+ done
+ _scratch_unmount
done
# Repair should detect and junk all test files
diff --git a/tests/xfs/348.out b/tests/xfs/348.out
index bf4924b..cdb7d78 100644
--- a/tests/xfs/348.out
+++ b/tests/xfs/348.out
@@ -20,6 +20,12 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=1 to all files:
core.mode = 010644
@@ -31,6 +37,12 @@ core.mode = 010644
would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: 'SCRATCH_MNT/test/CHRDEV' is a fifo
+stat: 'SCRATCH_MNT/test/BLKDEV' is a fifo
+stat: 'SCRATCH_MNT/test/FIFO' is a fifo
===== Setting dt=2 to all files:
core.mode = 020644
@@ -42,6 +54,12 @@ core.mode = 020644
would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: 'SCRATCH_MNT/test/CHRDEV' is a character special file
+stat: 'SCRATCH_MNT/test/BLKDEV' is a character special file
+stat: 'SCRATCH_MNT/test/FIFO' is a character special file
===== Setting dt=3 to all files:
core.mode = 030644
@@ -56,6 +74,12 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=4 to all files:
core.mode = 040644
@@ -68,6 +92,12 @@ would have junked entry "BLKDEV" in directory PARENT_INO
would have junked entry "CHRDEV" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
+stat: 'SCRATCH_MNT/test/DIR' is a directory
+stat: 'SCRATCH_MNT/test/FILE' is a directory
+stat: 'SCRATCH_MNT/test/SYMLINK' is a directory
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=5 to all files:
core.mode = 050644
@@ -82,6 +112,12 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=6 to all files:
core.mode = 060644
@@ -93,6 +129,12 @@ core.mode = 060644
would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: 'SCRATCH_MNT/test/CHRDEV' is a block special file
+stat: 'SCRATCH_MNT/test/BLKDEV' is a block special file
+stat: 'SCRATCH_MNT/test/FIFO' is a block special file
===== Setting dt=7 to all files:
core.mode = 070644
@@ -107,6 +149,12 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=10 to all files:
core.mode = 0100644
@@ -120,6 +168,12 @@ would have junked entry "CHRDEV" in directory PARENT_INO
would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: 'SCRATCH_MNT/test/FILE' is a regular file
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=11 to all files:
core.mode = 0110644
@@ -134,6 +188,12 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=12 to all files:
core.mode = 0120644
@@ -147,6 +207,12 @@ would have junked entry "CHRDEV" in directory PARENT_INO
would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
+stat: 'SCRATCH_MNT/test/DIR' is a symbolic link
+stat: 'SCRATCH_MNT/test/FILE' is a symbolic link
+stat: 'SCRATCH_MNT/test/SYMLINK' is a symbolic link
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=13 to all files:
core.mode = 0130644
@@ -161,6 +227,12 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=14 to all files:
core.mode = 0140644
@@ -172,6 +244,12 @@ core.mode = 0140644
would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: 'SCRATCH_MNT/test/CHRDEV' is a socket
+stat: 'SCRATCH_MNT/test/BLKDEV' is a socket
+stat: 'SCRATCH_MNT/test/FIFO' is a socket
===== Setting dt=15 to all files:
core.mode = 0150644
@@ -186,6 +264,12 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=16 to all files:
core.mode = 0160644
@@ -200,6 +284,12 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
===== Setting dt=17 to all files:
core.mode = 0170644
@@ -214,3 +304,9 @@ would have junked entry "DIR" in directory PARENT_INO
would have junked entry "FIFO" in directory PARENT_INO
would have junked entry "FILE" in directory PARENT_INO
would have junked entry "SYMLINK" in directory PARENT_INO
+stat: cannot stat 'SCRATCH_MNT/test/DIR': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FILE': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/SYMLINK': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/CHRDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/BLKDEV': Structure needs cleaning
+stat: cannot stat 'SCRATCH_MNT/test/FIFO': Structure needs cleaning
--
2.7.4
^ permalink raw reply related
* [PATCH v2 1/3] xfs/348: test handling of invalid inode modes
From: Amir Goldstein @ 2016-12-25 18:09 UTC (permalink / raw)
To: Eryu Guan, Darrick J . Wong, Christoph Hellwig
Cc: Brian Foster, fstests, linux-xfs
In-Reply-To: <1482689376-23553-1-git-send-email-amir73il@gmail.com>
Set all possible file type values for different types of files
and verify that xfs_repair detects the correct errors.
When setting invalid file type values (e.g. core.mode = 0170644),
all files are expected to have been junked by xfs_repair.
When setting valid file type values to non matching file types,
xfs_repair would either detect wrong format and junk the file, e.g.:
would have junked entry "FILE" in directory PARENT_INO
or detect a ftype mismatch error, e.g.:
would fix ftype mismatch (5/3) in directory/child PARENT_INO/FIFO_INO
If ftype feature is enabled, when setting file type to one of the
special types (i.e. FIFO(1), CHRDEV(2),BLKDEV(6),SOCKET(14)),
xfs_repair is expected to detect ftype mismatch error. Otherewise,
xfs_repair is not expected to detect ftype mismatch error.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/xfs/348 | 128 ++++++++++++++++++++++++++++++++
tests/xfs/348.out | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/group | 1 +
3 files changed, 345 insertions(+)
create mode 100755 tests/xfs/348
create mode 100644 tests/xfs/348.out
diff --git a/tests/xfs/348 b/tests/xfs/348
new file mode 100755
index 0000000..9ec696a
--- /dev/null
+++ b/tests/xfs/348
@@ -0,0 +1,128 @@
+#! /bin/bash
+# FSQA Test No. 348
+#
+# Test handling of invalid inode modes
+#
+# Set all possible file type values for different types of files
+# and verify that xfs_repair detects the correct errors.
+#
+#-----------------------------------------------------------------------
+#
+# Copyright (C) 2016 CTERA Networks. All Rights Reserved.
+# Author: Amir Goldstein <amir73il@gmail.com>
+#
+# 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"
+
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/repair
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+
+rm -f $seqres.full
+
+_scratch_mkfs >>$seqres.full 2>&1
+
+_scratch_mount
+
+# Create our test files.
+testdir=$SCRATCH_MNT/test
+mkdir -p $testdir
+mkdir $testdir/DIR
+echo 123 > $testdir/FILE
+ln -s $testdir/FILE $testdir/SYMLINK
+mknod $testdir/CHRDEV c 1 1
+mknod $testdir/BLKDEV b 1 1
+mknod $testdir/FIFO p
+
+xfs_info $SCRATCH_MNT | grep -q "ftype=1" && FTYPE_FEATURE=1
+
+# Record test dir inode for xfs_repair filter
+inode_filter=$tmp.sed
+rm -f $inode_filter
+pino=$(ls -id $testdir | awk '{print $1}')
+echo "s/inode $pino/PARENT_INO/" >> $inode_filter
+echo "s/directory $pino/directory PARENT_INO/" >> $inode_filter
+
+inodes=""
+# Record inode numbers for xfs_db commands and xfs_repair filter
+for f in DIR FILE SYMLINK CHRDEV BLKDEV FIFO; do
+ ino=$(ls -id $testdir/$f | awk '{print $1}')
+ inodes="$inodes $ino"
+ echo "s/inode $ino/${f}_INO/" >> $inode_filter
+done
+
+_scratch_unmount
+
+# Possible mode file type values (mode & S_IFMT) >> 12
+dtypes="0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17"
+echo "===== Find inode by file type:"
+for dt in $dtypes; do
+ # Set all our test files to dt value
+ for ino in $inodes; do
+ _scratch_xfs_db -c "inode $ino" -c "print core.mode" | \
+ grep -q "0${dt}0...$" && \
+ (echo "dt=$dt => inode $ino" | sed -f $inode_filter)
+ done
+done
+for dt in $dtypes; do
+ echo
+ echo "===== Setting dt=$dt to all files:"
+ # Set all our test files to dt value
+ for ino in $inodes; do
+ _scratch_xfs_db -x -c "inode $ino" -c "write core.mode 0${dt}0644"
+ done
+ # Repair should detect the inconsistencies
+ # For invalid dt values, all files would have been junked.
+ # For valid dt values, one test file is expected to be valid.
+ # The rest would either have wrong format or non matching dir ftype.
+ _scratch_xfs_repair -n 2>&1 | tee -a $seqres.full | \
+ _filter_repair | grep "^would have junked" | sed -f $inode_filter | sort -u
+ # If ftype feature is enabled, when setting file type to one of the
+ # special types (i.e. FIFO(1), CHRDEV(2),BLKDEV(6),SOCKET(14)),
+ # xfs_repair is expected to detect ftype mismatch error. Otherewise,
+ # xfs_repair is not expected to detect ftype mismatch error.
+ if [ "$FTYPE_FEATURE" = 1 ] && (echo ':1:2:6:14:' | grep -q ":$dt:"); then
+ _scratch_xfs_repair -n 2>&1 | grep -q "^would fix ftype mismatch" || \
+ _fail "xfs_repair should fix ftype mismatch"
+ else
+ _scratch_xfs_repair -n 2>&1 | grep -q -v "^would fix ftype mismatch" || \
+ _fail "xfs_repair should not fix ftype mismatch"
+ fi
+done
+
+# Repair should detect and junk all test files
+_scratch_xfs_repair 2>&1 >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
+
+status=0
+exit
diff --git a/tests/xfs/348.out b/tests/xfs/348.out
new file mode 100644
index 0000000..bf4924b
--- /dev/null
+++ b/tests/xfs/348.out
@@ -0,0 +1,216 @@
+QA output created by 348
+===== Find inode by file type:
+dt=1 => FIFO_INO
+dt=2 => CHRDEV_INO
+dt=4 => DIR_INO
+dt=6 => BLKDEV_INO
+dt=10 => FILE_INO
+dt=12 => SYMLINK_INO
+
+===== Setting dt=0 to all files:
+core.mode = 0644
+core.mode = 0644
+core.mode = 0644
+core.mode = 0644
+core.mode = 0644
+core.mode = 0644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=1 to all files:
+core.mode = 010644
+core.mode = 010644
+core.mode = 010644
+core.mode = 010644
+core.mode = 010644
+core.mode = 010644
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=2 to all files:
+core.mode = 020644
+core.mode = 020644
+core.mode = 020644
+core.mode = 020644
+core.mode = 020644
+core.mode = 020644
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=3 to all files:
+core.mode = 030644
+core.mode = 030644
+core.mode = 030644
+core.mode = 030644
+core.mode = 030644
+core.mode = 030644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=4 to all files:
+core.mode = 040644
+core.mode = 040644
+core.mode = 040644
+core.mode = 040644
+core.mode = 040644
+core.mode = 040644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+
+===== Setting dt=5 to all files:
+core.mode = 050644
+core.mode = 050644
+core.mode = 050644
+core.mode = 050644
+core.mode = 050644
+core.mode = 050644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=6 to all files:
+core.mode = 060644
+core.mode = 060644
+core.mode = 060644
+core.mode = 060644
+core.mode = 060644
+core.mode = 060644
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=7 to all files:
+core.mode = 070644
+core.mode = 070644
+core.mode = 070644
+core.mode = 070644
+core.mode = 070644
+core.mode = 070644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=10 to all files:
+core.mode = 0100644
+core.mode = 0100644
+core.mode = 0100644
+core.mode = 0100644
+core.mode = 0100644
+core.mode = 0100644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=11 to all files:
+core.mode = 0110644
+core.mode = 0110644
+core.mode = 0110644
+core.mode = 0110644
+core.mode = 0110644
+core.mode = 0110644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=12 to all files:
+core.mode = 0120644
+core.mode = 0120644
+core.mode = 0120644
+core.mode = 0120644
+core.mode = 0120644
+core.mode = 0120644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+
+===== Setting dt=13 to all files:
+core.mode = 0130644
+core.mode = 0130644
+core.mode = 0130644
+core.mode = 0130644
+core.mode = 0130644
+core.mode = 0130644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=14 to all files:
+core.mode = 0140644
+core.mode = 0140644
+core.mode = 0140644
+core.mode = 0140644
+core.mode = 0140644
+core.mode = 0140644
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=15 to all files:
+core.mode = 0150644
+core.mode = 0150644
+core.mode = 0150644
+core.mode = 0150644
+core.mode = 0150644
+core.mode = 0150644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=16 to all files:
+core.mode = 0160644
+core.mode = 0160644
+core.mode = 0160644
+core.mode = 0160644
+core.mode = 0160644
+core.mode = 0160644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=17 to all files:
+core.mode = 0170644
+core.mode = 0170644
+core.mode = 0170644
+core.mode = 0170644
+core.mode = 0170644
+core.mode = 0170644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
diff --git a/tests/xfs/group b/tests/xfs/group
index c237b50..68c2bb6 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -334,3 +334,4 @@
345 auto quick clone
346 auto quick clone
347 auto quick clone
+348 auto quick repair
--
2.7.4
^ permalink raw reply related
* [PATCH v2 0/3] xfs/348: test handling of malformed inode mode
From: Amir Goldstein @ 2016-12-25 18:09 UTC (permalink / raw)
To: Eryu Guan, Darrick J . Wong, Christoph Hellwig
Cc: Brian Foster, fstests, linux-xfs
Eryu,
I beefed up the initial test sent earlier today with more checks
on mounted fs.
The original patch testing only xfs_repair remains patch 1 in this series.
Patch 2 adds fstat tests on mounted fs, which are safe on my test system.
Patch 3 is explosive. It exposes an XFS assert, but I left a "safety pin"
that needs to be commented out to reproduce the assert.
I will soon post my kernel configs and dmesg logs.
Amir.
v2:
- test fstat with malformed inode mode
- test readlink/readdir with malformed inode mode
v1:
- test xfs_repair with malformed inode mode
Amir Goldstein (3):
xfs/348: test handling of invalid inode modes
xfs/348: test fstat with malformed inode mode
xfs/348: test readlink/readdir with malformed inode mode
tests/xfs/348 | 154 +++++++++++++++++++++++++++
tests/xfs/348.out | 312 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/group | 1 +
3 files changed, 467 insertions(+)
create mode 100755 tests/xfs/348
create mode 100644 tests/xfs/348.out
--
2.7.4
^ permalink raw reply
* [PATCH] xfs/348: test handling of invalid inode modes
From: Amir Goldstein @ 2016-12-25 11:00 UTC (permalink / raw)
To: Eryu Guan; +Cc: Brian Foster, Darrick J . Wong, fstests, linux-xfs
Set all possible file type values for different types of files
and verify that xfs_repair detects the correct errors.
When setting invalid file type values (e.g. core.mode = 0170644),
all files are expected to have been junked by xfs_repair.
When setting valid file type values to non matching file types,
xfs_repair would either detect wrong format and junk the file, e.g.:
would have junked entry "FILE" in directory PARENT_INO
or detect a ftype mismatch error, e.g.:
would fix ftype mismatch (5/3) in directory/child PARENT_INO/FIFO_INO
If ftype feature is enabled, when setting file type to one of the
special types (i.e. FIFO(1), CHRDEV(2),BLKDEV(6),SOCKET(14)),
xfs_repair is expected to detect ftype mismatch error. Otherewise,
xfs_repair is not expected to detect ftype mismatch error.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
tests/xfs/348 | 128 ++++++++++++++++++++++++++++++++
tests/xfs/348.out | 216 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/xfs/group | 1 +
3 files changed, 345 insertions(+)
create mode 100755 tests/xfs/348
create mode 100644 tests/xfs/348.out
diff --git a/tests/xfs/348 b/tests/xfs/348
new file mode 100755
index 0000000..89ba9a8
--- /dev/null
+++ b/tests/xfs/348
@@ -0,0 +1,128 @@
+#! /bin/bash
+# FSQA Test No. 348
+#
+# Test handling of invalid inode modes
+#
+# Set all possible file type values for different types of files
+# and verify that xfs_repair detects the correct errors.
+#
+#-----------------------------------------------------------------------
+#
+# Copyright (C) 2016 CTERA Networks. All Rights Reserved.
+# Author: Amir Goldstein <amir73il@gmail.com>
+#
+# 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"
+
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+. ./common/repair
+
+# real QA test starts here
+_supported_fs xfs
+_supported_os Linux
+_require_scratch
+
+rm -f $seqres.full
+
+_scratch_mkfs >>$seqres.full 2>&1
+
+_scratch_mount
+
+# Create our test files.
+testdir=$SCRATCH_MNT/test
+mkdir -p $testdir
+mkdir $testdir/DIR
+touch $testdir/FILE
+ln -s $testdir/FILE $testdir/SYMLINK
+mknod $testdir/CHRDEV c 1 1
+mknod $testdir/BLKDEV b 1 1
+mknod $testdir/FIFO p
+
+xfs_info $SCRATCH_MNT | grep -q "ftype=1" && FTYPE_FEATURE=1
+
+# Record test dir inode for xfs_repair filter
+inode_filter=$tmp.sed
+rm -f $inode_filter
+pino=$(ls -id $testdir | awk '{print $1}')
+echo "s/inode $pino/PARENT_INO/" >> $inode_filter
+echo "s/directory $pino/directory PARENT_INO/" >> $inode_filter
+
+inodes=""
+# Record inode numbers for xfs_db commands and xfs_repair filter
+for f in DIR FILE SYMLINK CHRDEV BLKDEV FIFO; do
+ ino=$(ls -id $testdir/$f | awk '{print $1}')
+ inodes="$inodes $ino"
+ echo "s/inode $ino/${f}_INO/" >> $inode_filter
+done
+
+_scratch_unmount
+
+# Possible mode file type values (mode & S_IFMT) >> 12
+dtypes="0 1 2 3 4 5 6 7 10 11 12 13 14 15 16 17"
+echo "===== Find inode by file type:"
+for dt in $dtypes; do
+ # Set all our test files to dt value
+ for ino in $inodes; do
+ _scratch_xfs_db -c "inode $ino" -c "print core.mode" | \
+ grep -q "0${dt}0...$" && \
+ (echo "dt=$dt => inode $ino" | sed -f $inode_filter)
+ done
+done
+for dt in $dtypes; do
+ echo
+ echo "===== Setting dt=$dt to all files:"
+ # Set all our test files to dt value
+ for ino in $inodes; do
+ _scratch_xfs_db -x -c "inode $ino" -c "write core.mode 0${dt}0644"
+ done
+ # Repair should detect the inconsistencies
+ # For invalid dt values, all files would have been junked.
+ # For valid dt values, one test file is expected to be valid.
+ # The rest would either have wrong format or non matching dir ftype.
+ _scratch_xfs_repair -n 2>&1 | tee -a $seqres.full | \
+ _filter_repair | grep "^would have junked" | sed -f $inode_filter | sort -u
+ # If ftype feature is enabled, when setting file type to one of the
+ # special types (i.e. FIFO(1), CHRDEV(2),BLKDEV(6),SOCKET(14)),
+ # xfs_repair is expected to detect ftype mismatch error. Otherewise,
+ # xfs_repair is not expected to detect ftype mismatch error.
+ if [ "$FTYPE_FEATURE" = 1 ] && (echo ':1:2:6:14:' | grep -q ":$dt:"); then
+ _scratch_xfs_repair -n 2>&1 | grep -q "^would fix ftype mismatch" || \
+ _fail "xfs_repair should fix ftype mismatch"
+ else
+ _scratch_xfs_repair -n 2>&1 | grep -q -v "^would fix ftype mismatch" || \
+ _fail "xfs_repair should not fix ftype mismatch"
+ fi
+done
+
+# Repair should detect and junk all test files
+_scratch_xfs_repair 2>&1 >> $seqres.full 2>&1 || _fail "xfs_repair should not fail"
+
+status=0
+exit
diff --git a/tests/xfs/348.out b/tests/xfs/348.out
new file mode 100644
index 0000000..bf4924b
--- /dev/null
+++ b/tests/xfs/348.out
@@ -0,0 +1,216 @@
+QA output created by 348
+===== Find inode by file type:
+dt=1 => FIFO_INO
+dt=2 => CHRDEV_INO
+dt=4 => DIR_INO
+dt=6 => BLKDEV_INO
+dt=10 => FILE_INO
+dt=12 => SYMLINK_INO
+
+===== Setting dt=0 to all files:
+core.mode = 0644
+core.mode = 0644
+core.mode = 0644
+core.mode = 0644
+core.mode = 0644
+core.mode = 0644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=1 to all files:
+core.mode = 010644
+core.mode = 010644
+core.mode = 010644
+core.mode = 010644
+core.mode = 010644
+core.mode = 010644
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=2 to all files:
+core.mode = 020644
+core.mode = 020644
+core.mode = 020644
+core.mode = 020644
+core.mode = 020644
+core.mode = 020644
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=3 to all files:
+core.mode = 030644
+core.mode = 030644
+core.mode = 030644
+core.mode = 030644
+core.mode = 030644
+core.mode = 030644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=4 to all files:
+core.mode = 040644
+core.mode = 040644
+core.mode = 040644
+core.mode = 040644
+core.mode = 040644
+core.mode = 040644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+
+===== Setting dt=5 to all files:
+core.mode = 050644
+core.mode = 050644
+core.mode = 050644
+core.mode = 050644
+core.mode = 050644
+core.mode = 050644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=6 to all files:
+core.mode = 060644
+core.mode = 060644
+core.mode = 060644
+core.mode = 060644
+core.mode = 060644
+core.mode = 060644
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=7 to all files:
+core.mode = 070644
+core.mode = 070644
+core.mode = 070644
+core.mode = 070644
+core.mode = 070644
+core.mode = 070644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=10 to all files:
+core.mode = 0100644
+core.mode = 0100644
+core.mode = 0100644
+core.mode = 0100644
+core.mode = 0100644
+core.mode = 0100644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=11 to all files:
+core.mode = 0110644
+core.mode = 0110644
+core.mode = 0110644
+core.mode = 0110644
+core.mode = 0110644
+core.mode = 0110644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=12 to all files:
+core.mode = 0120644
+core.mode = 0120644
+core.mode = 0120644
+core.mode = 0120644
+core.mode = 0120644
+core.mode = 0120644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+
+===== Setting dt=13 to all files:
+core.mode = 0130644
+core.mode = 0130644
+core.mode = 0130644
+core.mode = 0130644
+core.mode = 0130644
+core.mode = 0130644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=14 to all files:
+core.mode = 0140644
+core.mode = 0140644
+core.mode = 0140644
+core.mode = 0140644
+core.mode = 0140644
+core.mode = 0140644
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=15 to all files:
+core.mode = 0150644
+core.mode = 0150644
+core.mode = 0150644
+core.mode = 0150644
+core.mode = 0150644
+core.mode = 0150644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=16 to all files:
+core.mode = 0160644
+core.mode = 0160644
+core.mode = 0160644
+core.mode = 0160644
+core.mode = 0160644
+core.mode = 0160644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
+
+===== Setting dt=17 to all files:
+core.mode = 0170644
+core.mode = 0170644
+core.mode = 0170644
+core.mode = 0170644
+core.mode = 0170644
+core.mode = 0170644
+would have junked entry "BLKDEV" in directory PARENT_INO
+would have junked entry "CHRDEV" in directory PARENT_INO
+would have junked entry "DIR" in directory PARENT_INO
+would have junked entry "FIFO" in directory PARENT_INO
+would have junked entry "FILE" in directory PARENT_INO
+would have junked entry "SYMLINK" in directory PARENT_INO
diff --git a/tests/xfs/group b/tests/xfs/group
index c237b50..68c2bb6 100644
--- a/tests/xfs/group
+++ b/tests/xfs/group
@@ -334,3 +334,4 @@
345 auto quick clone
346 auto quick clone
347 auto quick clone
+348 auto quick repair
--
2.7.4
^ permalink raw reply related
* [ANNOUNCE] fstests: master branch updated to 7ee1d97c799b
From: Eryu Guan @ 2016-12-25 10:56 UTC (permalink / raw)
To: fstests
[-- Attachment #1: Type: text/plain, Size: 3957 bytes --]
Hi all,
The master branch of the xfstests repository at:
git://git.kernel.org/pub/scm/fs/xfs/xfstests-dev.git
have just been updated. This is a relatively large update. Notably, fs
encryption tests from Eric Biggers have been merged. But these tests won't run
now, as set|get_policy commands are not in xfs_io yet. _scratch_mkfs has also
been updated so that, besides xfs and ext4, other filesystems are able to
handle mkfs option conflicts between $MKFS_OPTIONS and options specified in
tests. There're also new generic and overlay tests, one btrfs test is removed.
New failures I've noticed in this update:
- generic/399 fails on ext4, it's a known fs encryption bug (if you tested with
set|get_policy xfs_io patch applied manually)
- generic/400 fails on XFS, there's a patch from Eric Sandeen to fix it in XFS
- generic/401 fails on NFSv4 (NFSv3 passes the filetype test) as NFSv4 reports
filetype of . and .. as DT_UNKNOWN, while reports filetype of other files
correctly
Thanks,
Eryu
The new head of the master branch is commit:
7ee1d97c799b generic: test correct d_type values
New commits:
Amir Goldstein (3):
[9aead226d330] common/rc: factor out _supports_filetype() helper
[d0d42a38211c] common/rc: add generic file type support check
[7ee1d97c799b] generic: test correct d_type values
Eric Biggers (6):
[3419026f0719] encrypt: add utilities for testing filesystem encryption
[b8f280fcdb67] generic: test setting and getting encryption policies
[88d1c426f4ea] generic: test validation of encryption policy structure
[758175fad3c6] generic: test encrypted file access
[0f7a9791309e] generic: test enforcement of one encryption policy per tree
[716691159e4f] generic: test for weaknesses in filesystem encryption
Eric Sandeen (3):
[3cbd329a14bd] generic: test GETNEXTQUOTA near INT_MAX
[a4f96daeb1c8] generic/244: remove extra junk
[3b3191806f67] common: add _require_getnextquota helper
Eryu Guan (1):
[596a068bf130] fstests: teach _scratch_mkfs to handle mkfs option conflicts
Qu Wenruo (1):
[312e7ce2da53] btrfs/047: Remove test since upstream don't accept stream-version
Theodore Ts'o (1):
[030fd2aea20f] overlay: stress test changes to top and bottom layers simultaneously
Code Diffstat:
.gitignore | 1 +
common/btrfs | 14 ----
common/config | 2 +
common/encrypt | 146 +++++++++++++++++++++++++++++++++
common/quota | 10 +++
common/rc | 220 ++++++++++++++++++++++++++++++--------------------
common/xfs | 47 +++--------
src/Makefile | 2 +-
src/t_dir_type.c | 108 +++++++++++++++++++++++++
src/test-nextquota.c | 37 +++++----
tests/btrfs/028 | 2 +-
tests/btrfs/047 | 120 ---------------------------
tests/btrfs/047.out | 35 --------
tests/btrfs/121 | 2 +-
tests/btrfs/122 | 2 +-
tests/btrfs/123 | 2 +-
tests/btrfs/126 | 2 +-
tests/btrfs/group | 1 -
tests/generic/244 | 12 +--
tests/generic/395 | 135 +++++++++++++++++++++++++++++++
tests/generic/395.out | 43 ++++++++++
tests/generic/396 | 82 +++++++++++++++++++
tests/generic/396.out | 18 +++++
tests/generic/397 | 144 +++++++++++++++++++++++++++++++++
tests/generic/397.out | 13 +++
tests/generic/398 | 158 ++++++++++++++++++++++++++++++++++++
tests/generic/398.out | 45 +++++++++++
tests/generic/399 | 166 +++++++++++++++++++++++++++++++++++++
tests/generic/399.out | 3 +
tests/generic/400 | 89 ++++++++++++++++++++
tests/generic/400.out | 8 ++
tests/generic/401 | 95 ++++++++++++++++++++++
tests/generic/401.out | 9 +++
tests/generic/group | 7 ++
tests/overlay/019 | 95 ++++++++++++++++++++++
tests/overlay/019.out | 2 +
tests/overlay/group | 1 +
37 files changed, 1554 insertions(+), 324 deletions(-)
--
Eryu Guan
eguan@redhat.com
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 801 bytes --]
^ permalink raw reply
* [PATCH v2] generic/390: Add tests for inode timestamp policy
From: Deepa Dinamani @ 2016-12-25 3:38 UTC (permalink / raw)
To: fstests; +Cc: arnd, y2038
The test helps to validate clamping and mount behaviors
according to supported file system timestamp ranges.
Note that the test can fail on 32-bit systems for a
few file systems. This will be corrected when vfs is
transitioned to use 64-bit timestamps.
Signed-off-by: Deepa Dinamani <deepa.kernel@gmail.com>
---
The branch of the kernel tree can be located at
https://github.com/deepa-hub/vfs refs/heads/vfs_timestamp_policy
The xfs_io patch to add utimes is at
https://www.spinics.net/lists/linux-xfs/msg02952.html
Changes since v1:
* Use xfs_io utimes command
* Updated error handling
* Reorganized code according to review comments
common/rc | 42 +++++++++++
tests/generic/390 | 197 ++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/390.out | 2 +
tests/generic/group | 1 +
4 files changed, 242 insertions(+)
create mode 100755 tests/generic/390
create mode 100644 tests/generic/390.out
diff --git a/common/rc b/common/rc
index e3b54ec..93c6e65 100644
--- a/common/rc
+++ b/common/rc
@@ -1960,6 +1960,45 @@ _run_aiodio()
return $status
}
+# this test requires y2038 sysfs switch support
+#
+_require_y2038_sysfs()
+{
+ sysfsdir=/proc/sys/fs/fs-timestamp-check-on
+
+ if [ ! -e $sysfsdir ]; then
+ _notrun "no kernel support for y2038 sysfs switch"
+ fi
+}
+
+_filesystem_timestamp_range()
+{
+ device=${1:-$TEST_DEV}
+ case $FSTYP in
+ ext4)
+ if [ $(dumpe2fs -h $device 2>/dev/null | grep "Inode size:" | cut -d: -f2) -gt 128 ]; then
+ echo "-2147483648 15032385535"
+ else
+ echo "-2147483648 2147483647"
+ fi
+ ;;
+
+ xfs)
+ echo "-2147483648 2147483647"
+ ;;
+ jfs)
+ echo "0 4294967295"
+ ;;
+ f2fs)
+ echo "-2147483648 2147483647"
+ ;;
+ *)
+ echo "-1 -1"
+ _notrun "filesystem $FSTYP timestamp bounds are unknown"
+ ;;
+ esac
+}
+
# indicate whether YP/NIS is active or not
#
_yp_active()
@@ -2070,6 +2109,9 @@ _require_xfs_io_command()
echo $testio | egrep -q "Inappropriate ioctl" && \
_notrun "xfs_io $command support is missing"
;;
+ "utimes" )
+ testio=`$XFS_IO_PROG -f -c "utimes" 0 0 0 0 $testfile 2>&1`
+ ;;
*)
testio=`$XFS_IO_PROG -c "$command help" 2>&1`
esac
diff --git a/tests/generic/390 b/tests/generic/390
new file mode 100755
index 0000000..8ccadad
--- /dev/null
+++ b/tests/generic/390
@@ -0,0 +1,197 @@
+#! /bin/bash
+# FS QA Test 390
+#
+# Tests to verify policy for filesystem timestamps for
+# supported ranges:
+# 1. Verify filesystem rw mount according to sysctl
+# timestamp_supported.
+# 2. Verify timestamp clamping for timestamps beyond max
+# timestamp supported.
+#
+# Exit status 1: either or both tests above fail.
+# Exit status 0: both the above tests pass.
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Deepa Dinamani. 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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "exit \$status" 0 1 2 3 15
+
+# Get standard environment, filters and checks.
+. ./common/rc
+. ./common/filter
+. ./common/attr
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# Prerequisites for the test run.
+_supported_fs generic
+_supported_os Linux
+_require_scratch
+_require_xfs_io_command utimes
+_require_y2038_sysfs
+
+# Compare file timestamps obtained from stat
+# with a given timestamp.
+check_stat()
+{
+ file=$1
+ timestamp=$2
+
+ stat_timestamp=`stat -c"%X;%Y" $file`
+
+ prev_timestamp="$timestamp;$timestamp"
+ if [ $prev_timestamp != $stat_timestamp ]; then
+ echo "$prev_timestamp != $stat_timestamp" | tee -a $seqres.full
+ exit
+ fi
+}
+
+run_test_individual()
+{
+ file=$1
+ timestamp=$2
+ update_time=$3
+
+ #check if the time needs update
+ if [ $update_time -eq 1 ]; then
+ echo "Updating file: $file to timestamp `date -d @$timestamp`" >> $seqres.full
+ $XFS_IO_PROG -f -c "utimes $timestamp 0 $timestamp 0" $file
+ if [ $? -ne 0 ]; then
+ echo "Failed to update times on $file" | tee -a $seqres.full
+ exit
+ fi
+ fi
+
+ tsclamp=$(($timestamp>$tsmax?$tsmax:$timestamp))
+ echo "Checking file: $file Updated timestamp is `date -d @$tsclamp`" >> $seqres.full
+ check_stat $file $tsclamp
+}
+
+run_test()
+{
+ update_time=$1
+
+ #initialization iterator
+ n=1
+
+ for TIME in "${TIMESTAMPS[@]}"
+ do
+ #Run the test
+ run_test_individual ${SCRATCH_MNT}/test_$n $TIME $update_time
+
+ #update iterator
+ ((n++))
+ done
+}
+
+_scratch_mkfs &>> $seqres.full 2>&1 || _fail "mkfs failed"
+read tsmin tsmax <<<$(_filesystem_timestamp_range $SCRATCH_DEV)
+
+echo min supported timestamp $tsmin $(date --date=@$tsmin) >> $seqres.full
+echo max supported timestamp $tsmax $(date --date=@$tsmax) >> $seqres.full
+
+#Test timestamps array
+
+declare -a TIMESTAMPS=(
+ $tsmin
+ 0
+ $tsmax
+ $((tsmax+1))
+ 4294967295
+ 8589934591
+ 34359738367
+)
+
+# Max timestamp is hardcoded to Mon Jan 18 19:14:07 PST 2038
+sys_tsmax=2147483647
+echo "min timestamp that needs to be supported by fs for rw mount is $sys_tsmax $(date --date=@$sys_tsmax)" >> $seqres.full
+
+read ts_check <<<$(cat /proc/sys/fs/fs-timestamp-check-on)
+
+_scratch_mount
+result=$?
+
+if [ $ts_check -ne 0 ]; then
+ echo "sysctl filesystem timestamp check is on" >> $seqres.full
+ if [ $sys_tsmax -gt $tsmax ]; then
+ if [ $result -eq 0 ]; then
+ echo "mount test failed" | tee -a $seqres.full
+ exit
+ fi
+ else
+ if [ $result -ne 0 ]; then
+ echo "failed to mount $SCRATCH_DEV" | tee -a $seqres.full
+ exit
+ fi
+ fi
+else
+ echo "sysctl filesystem timestamp check is off" >> $seqres.full
+ if [ $result -ne 0 ]; then
+ echo "failed to mount $SCRATCH_DEV and timestamp check is off" >> $seqres.full
+ exit
+ fi
+fi
+
+# Begin test case 1
+echo "In memory timestamps update test start" >> $seqres.full
+
+#update time on the file
+update_time=1
+
+#Run test
+run_test $update_time
+
+echo "In memory timestamps update complete" >> $seqres.full
+
+echo "Unmounting and mounting scratch $SCRATCH_MNT" >> $seqres.full
+
+#unmount and remount $SCRATCH_DEV
+_scratch_cycle_mount
+if [ $? -ne 0 ];then
+ echo "Failed to remount $SCRATCH_DEV" | tee -a $seqres.full
+ exit
+fi
+
+# Begin test case 2
+
+#re-initialize iterator
+n=1
+
+#Do not update time on the file, just read from disk
+update_time=0
+
+echo "On disk timestamps update test start" >> $seqres.full
+
+#Re-run test
+run_test $update_time
+
+echo "On disk timestamps update test complete" >> $seqres.full
+
+echo "y2038 inode timestamp tests completed successfully"
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/390.out b/tests/generic/390.out
new file mode 100644
index 0000000..82bd4eb
--- /dev/null
+++ b/tests/generic/390.out
@@ -0,0 +1,2 @@
+QA output created by 390
+y2038 inode timestamp tests completed successfully
diff --git a/tests/generic/group b/tests/generic/group
index 08007d7..d137d01 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -392,3 +392,4 @@
387 auto clone
388 auto log metadata
389 auto quick acl
+390 auto quick rw
--
2.7.4
^ permalink raw reply related
* Re: [PATCH v3 3/3] generic/396: test correct d_type values
From: Eryu Guan @ 2016-12-24 12:20 UTC (permalink / raw)
To: Amir Goldstein
Cc: Dave Chinner, Christoph Hellwig, Darrick J . Wong,
Theodore Ts'o, fstests
In-Reply-To: <1482328221-31713-1-git-send-email-amir73il@gmail.com>
On Wed, Dec 21, 2016 at 03:50:21PM +0200, Amir Goldstein wrote:
> Verify correct d_type values of dir entries.
>
> This test does NOT require that file system support the filetype feature.
> It verifies that either all file types are reported as DT_UNKNOWN
> or that all file types are reported correctly.
>
> For fs for which we know how to test the filetype feature (xfs|ext*)
> verify getting DT_UNKNOWN IFF filetype feature is disabled.
>
> Special dir entries . and .. MAY be reported as DT_UNKNOWN IF filetype
> feature is disabled (ext4), but MAY also be reported as DT_DIR in this
> case (xfs).
>
> Signed-off-by: Amir Goldstein <amir73il@gmail.com>
> ---
> tests/generic/396 | 93 +++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/generic/396.out | 9 +++++
> tests/generic/group | 1 +
> 3 files changed, 103 insertions(+)
> create mode 100755 tests/generic/396
> create mode 100644 tests/generic/396.out
>
> Added another test to the matrix, found another special case to handle:
> ext4 vs. xfs returns DT_UNKNOWN for . and .. on ! _supports_filetype.
>
> Fixes the test to correctly handle both cases.
>
> Tested with tmpfs, ext2, ext4, xfs for d_type supported fs
> Tested with xfs -m crc=0 -n ftype=0 for d_type unsupported fs
> Tested with ext2/ext4 -O ^filetype for d_type unsupported fs
>
> v3:
> - allow DT_UNKNOWN type for . and .. when filetype feature is disabled (ext4)
>
> v2:
> - use helper to test for file type support
> - allow DT_UNKNOWN type, but only for all files
> - verify . and .. have DT_DIR type
>
> v1:
> - verify that d_type matches actual file type
>
> diff --git a/tests/generic/396 b/tests/generic/396
> new file mode 100755
> index 0000000..0d4a17d
> --- /dev/null
> +++ b/tests/generic/396
> @@ -0,0 +1,93 @@
> +#! /bin/bash
> +# FSQA Test No. 396
> +#
> +# Test filetype feature
> +#
> +# This test does NOT require that file system support the d_type feature.
> +# It verifies that either all file types are reported as DT_UNKNOWN
> +# or all file types are reported correctly.
> +#
> +# For fs for which we know how to test the filetype feature (xfs|ext*)
> +# verify getting DT_UNKNOWN IFF feature is disabled.
> +# Special dir entries . and .. MAY be reported as DT_UNKNOWN IF filetype
> +# feature is disabled (ext4), but MAY also be reported as DT_DIR in this
> +# case (xfs).
> +#
> +#-----------------------------------------------------------------------
> +#
> +# Copyright (C) 2016 CTERA Networks. All Rights Reserved.
> +# Author: Amir Goldstein <amir73il@gmail.com>
> +#
> +# 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"
> +
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# real QA test starts here
> +_supported_fs generic
> +_supported_os Linux
> +_require_scratch
I added a "_require_test_program t_dir_type" here and merged.
Thanks,
Eryu
^ permalink raw reply
* Re: [PATCH V2] generic/395: test GETNEXTQUOTA near INT_MAX
From: Eryu Guan @ 2016-12-24 10:20 UTC (permalink / raw)
To: Eric Sandeen; +Cc: Eric Sandeen, fstests
In-Reply-To: <8c91051e-8a78-cb20-d926-ea86e5b4645a@sandeen.net>
On Wed, Dec 21, 2016 at 07:11:21PM -0600, Eric Sandeen wrote:
> XFS kernel code had a bug where GETNEXTQUOTA-type
> quotactls requesting an ID near UINT_MAX could overflow
> and return 0 as the "next" active ID.
>
> This test checks that by creating an active quota near
> UINT_MAX, then asking for the next one after it.
>
> The proper answer is ENOENT, but if we wrap we'll return
> ID 0.
>
> This also changes test-nextquota.c so that it checks
> both GETNEXTQUOTA and XGETNEXTQUOTA even if one fails;
> it stores the failure conditions and returns 1 if either
> of them fails.
>
> Signed-off-by: Eric Sandeen <sandeen@redhat.com>
> ---
>
> V2: cleanups from Eryu's review.
>
> Eryu - I need to send a _require_getnextquota patch, and some
> other cleanups to 244, similar to your review of this test
> (I copied this test from 244).
>
> I'll do that in reply to this patch, hopfully tonight, yet.
Thanks, Eric!
> +# remount just for kicks, make sure we get it off disk
> +_scratch_unmount
> +_qmount
> +quotaon $SCRATCH_MNT 2>/dev/null
I removed this quotaon too and merged.
Thanks,
Eryu
^ permalink raw reply
* Re: [PATCH] fstests: btrfs: Test scrub and replace race for RAID56
From: Eryu Guan @ 2016-12-24 9:45 UTC (permalink / raw)
To: Qu Wenruo; +Cc: linux-btrfs, fstests
In-Reply-To: <20161222020251.12272-1-quwenruo@cn.fujitsu.com>
On Thu, Dec 22, 2016 at 10:02:51AM +0800, Qu Wenruo wrote:
> Although by design, btrfs scrub and replace share the same code path, so
> they are exclusive to each other.
>
> But the fact is, there is still some critical region not protected well,
> so we can have the following kernel panic, especially easy to trigger on
> RAID5/6 profiles.
Could btrfs/069 reproduce the panic? It also races scrub and replace,
but with fsstress running in background, raid5/6 profiles are part of
the default test configs.
Also, is there a known fix available in Linus tree or btrfs tree? If
not, I'd push this new test after there's a known fix (if it's worth a
new test).
Thanks,
Eryu
^ permalink raw reply
* [PATCH -v3] overlay: stress test changes to top and bottom layers simultaneously
From: Theodore Ts'o @ 2016-12-22 19:53 UTC (permalink / raw)
To: fstests; +Cc: linux-unionfs, Theodore Ts'o
In-Reply-To: <CAOQ4uxjbYwCBEV_sC98yd9j4rkNrcf+okcVhZB-9JL_sbyAzmw@mail.gmail.com>
Introduce a test which runs fsstress on the top and bottom overlayfs
directories simultaneously to find potential races that plagued wrapfs
derived file systems.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
tests/overlay/019 | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/overlay/019.out | 2 ++
tests/overlay/group | 1 +
3 files changed, 84 insertions(+)
create mode 100644 tests/overlay/019
create mode 100644 tests/overlay/019.out
diff --git a/tests/overlay/019 b/tests/overlay/019
new file mode 100644
index 00000000..1daf830f
--- /dev/null
+++ b/tests/overlay/019
@@ -0,0 +1,81 @@
+#! /bin/bash
+# FS QA Test 019
+#
+# Run fsstress on lower dir and top dir at the same time
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs overlay
+_supported_os Linux
+_require_scratch
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
+mkdir -p $lowerdir
+
+_scratch_mount
+
+echo "Silence is golden"
+
+d_low=$lowerdir/fsstress
+d_top=$SCRATCH_MNT/fsstress
+mkdir -p $d_low $d_top
+
+echo $FSSTRESS_PROG -s 42 -d $d_low -p 4 -n 1000 -l100 -v > $seqres.full.1
+$FSSTRESS_PROG -s 42 -d $d_low -p 4 -n 1000 -l100 -v >> $seqres.full.1 2>&1 &
+
+echo $FSSTRESS_PROG -s 42 -d $d_top -p 4 -n 1000 -l100 -v > $seqres.full.2
+$FSSTRESS_PROG -s 42 -d $d_top -p 4 -n 1000 -l100 -v >> $seqres.full.2 2>&1 &
+
+ret=0
+if ! wait %1
+then
+ echo "--------------------------------------" >>$seqres.full.1
+ echo "fsstress on lower directory returned $? - see $seqres.full.1"
+ echo "--------------------------------------" >>$seqres.full.1
+ ret=1
+fi
+
+if ! wait %2
+then
+ echo "--------------------------------------" >>$seqres.full.2
+ echo "fsstress on overlay directory returned $? - see $seqres.full.2"
+ echo "--------------------------------------" >>$seqres.full.2
+ ret=1
+fi
+
+cat $seqres.full.1 $seqres.full.2 > $seqres.full
+rm $seqres.full.1 $seqres.full.2
+
+if [ "$ret" -eq 1 ]
+then
+ status=1
+else
+ status=0
+fi
+
+exit $status
diff --git a/tests/overlay/019.out b/tests/overlay/019.out
new file mode 100644
index 00000000..163484bc
--- /dev/null
+++ b/tests/overlay/019.out
@@ -0,0 +1,2 @@
+QA output created by 019
+Silence is golden
diff --git a/tests/overlay/group b/tests/overlay/group
index 74822cbf..f8de84be 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -21,3 +21,4 @@
016 auto quick copyup
017 auto quick copyup
018 auto quick copyup
+019 quick stress
--
2.11.0.rc0.7.gbe5a750
^ permalink raw reply related
* Re: [PATCH -v2] overlay: stress test changes to top and bottom layers simultaneously
From: Amir Goldstein @ 2016-12-22 17:25 UTC (permalink / raw)
To: Theodore Ts'o; +Cc: fstests, linux-unionfs
In-Reply-To: <20161222164310.9615-1-tytso@mit.edu>
On Thu, Dec 22, 2016 at 6:43 PM, Theodore Ts'o <tytso@mit.edu> wrote:
> Introduce a test which runs fsstress on the top and bottom overlayfs
> directories simultaneously to find potential races that plagued wrapfs
> derived file systems.
>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> ---
> tests/overlay/019 | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
> tests/overlay/019.out | 2 ++
> tests/overlay/group | 1 +
> 3 files changed, 84 insertions(+)
> create mode 100644 tests/overlay/019
> create mode 100644 tests/overlay/019.out
>
> diff --git a/tests/overlay/019 b/tests/overlay/019
> new file mode 100644
> index 00000000..1daf830f
> --- /dev/null
> +++ b/tests/overlay/019
> @@ -0,0 +1,81 @@
> +#! /bin/bash
> +# FS QA Test 019
> +#
> +# Run fsstress on lower dir and top dir at the same time
> +#
> +
> +seq=`basename $0`
> +seqres=$RESULT_DIR/$seq
> +echo "QA output created by $seq"
> +
> +here=`pwd`
> +tmp=/tmp/$$
> +status=1 # failure is the default!
> +trap "_cleanup; exit \$status" 0 1 2 3 15
> +
> +_cleanup()
> +{
> + cd /
> + rm -f $tmp.*
> +}
> +
> +# get standard environment, filters and checks
> +. ./common/rc
> +. ./common/filter
> +
> +# remove previous $seqres.full before test
> +rm -f $seqres.full
> +
> +# real QA test starts here
> +_supported_fs overlay
> +_supported_os Linux
> +_require_scratch
> +
> +# Remove all files from previous tests
> +_scratch_mkfs
> +
> +lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
> +mkdir -p $lowerdir
> +
> +_scratch_mount
> +
> +echo "Silence is golden"
> +
> +d_low=$lowerdir/fsstress
> +d_top=$SCRATCH_MNT/fsstress
> +mkdir -p $d_low $d_top
> +
> +echo $FSSTRESS_PROG -s 42 -d $d_low -p 4 -n 1000 -l100 -v > $seqres.full.1
> +$FSSTRESS_PROG -s 42 -d $d_low -p 4 -n 1000 -l100 -v >> $seqres.full.1 2>&1 &
> +
> +echo $FSSTRESS_PROG -s 42 -d $d_top -p 4 -n 1000 -l100 -v > $seqres.full.2
> +$FSSTRESS_PROG -s 42 -d $d_top -p 4 -n 1000 -l100 -v >> $seqres.full.2 2>&1 &
> +
> +ret=0
> +if ! wait %1
> +then
> + echo "--------------------------------------" >>$seqres.full.1
> + echo "fsstress on lower directory returned $? - see $seqres.full.1"
> + echo "--------------------------------------" >>$seqres.full.1
> + ret=1
> +fi
> +
> +if ! wait %2
> +then
> + echo "--------------------------------------" >>$seqres.full.2
> + echo "fsstress on overlay directory returned $? - see $seqres.full.2"
> + echo "--------------------------------------" >>$seqres.full.2
> + ret=1
> +fi
> +
> +cat $seqres.full.1 $seqres.full.2 > $seqres.full
> +rm $seqres.full.1 $seqres.full.2
> +
> +if [ "$ret" -eq 1 ]
> +then
> + status=1
> +else
> + status=0
> +fi
> +
> +exit $status
> diff --git a/tests/overlay/019.out b/tests/overlay/019.out
> new file mode 100644
> index 00000000..163484bc
> --- /dev/null
> +++ b/tests/overlay/019.out
> @@ -0,0 +1,2 @@
> +QA output created by 019
> +Silence is golden
> diff --git a/tests/overlay/group b/tests/overlay/group
> index 74822cbf..f8de84be 100644
> --- a/tests/overlay/group
> +++ b/tests/overlay/group
> @@ -21,3 +21,4 @@
> 016 auto quick copyup
> 017 auto quick copyup
> 018 auto quick copyup
> +019 quick stress
You probably meant:
019 auto stress
^ permalink raw reply
* Re: [PATCH] xfstests-bld: remove redundant listing of GCE images
From: Theodore Ts'o @ 2016-12-22 17:13 UTC (permalink / raw)
To: Eric Biggers; +Cc: fstests, Eric Biggers
In-Reply-To: <1482343592-135031-6-git-send-email-ebiggers3@gmail.com>
On Wed, Dec 21, 2016 at 10:06:32AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> When a GCE image is created, the same information about the new image
> was being printed by both 'gcloud compute images create' and 'gcloud
> compute images list'. Fix this by removing the call to 'gcloud compute
> images list'.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
This was deliberate; the goal was to remind the image maintainer to
consider whether some of the older images should be GC'ed.
- Ted
^ permalink raw reply
* Re: [PATCH] xfstests-bld: remove dead code for gce-xfstests get-results
From: Theodore Ts'o @ 2016-12-22 17:10 UTC (permalink / raw)
To: Eric Biggers; +Cc: fstests, Eric Biggers
In-Reply-To: <1482343592-135031-5-git-send-email-ebiggers3@gmail.com>
On Wed, Dec 21, 2016 at 10:06:31AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> The 'gce-xfstests get-results' command was implemented in two places.
> Remove the dead version.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
Thanks, applied.
- Ted
^ permalink raw reply
* Re: [PATCH] xfstests-bld: include xz-utils in kvm-xfstests appliance
From: Theodore Ts'o @ 2016-12-22 17:08 UTC (permalink / raw)
To: Eric Biggers; +Cc: fstests, Eric Biggers
In-Reply-To: <1482343592-135031-4-git-send-email-ebiggers3@gmail.com>
On Wed, Dec 21, 2016 at 10:06:30AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> xz will be needed by one of the new encryption tests. It was already
> included in the gce-xfstests appliance, but it was missing from the
> kvm-xfstests appliance.
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
Thanks, applied.
- Ted
^ permalink raw reply
* Re: [PATCH] xfstests-bld: include f2fs userspace tools in test appliances
From: Theodore Ts'o @ 2016-12-22 17:07 UTC (permalink / raw)
To: Eric Biggers; +Cc: fstests, Eric Biggers
In-Reply-To: <1482343592-135031-3-git-send-email-ebiggers3@gmail.com>
On Wed, Dec 21, 2016 at 10:06:29AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> Signed-off-by: Eric Biggers <ebiggers@google.com>
Sure, applied. I hadn't bothered because I built a newer version of
f2fs-tools from the git repository as a debian package and dropped it
in kvm-xfststs/test-appliance/debs. It's been on my todo list work
with the Debian maintainer to get a newer version into
jessie-backports....
- Ted
^ permalink raw reply
* Re: [PATCH] xfstests-bld: document how to add debian packages to GCE image
From: Theodore Ts'o @ 2016-12-22 17:04 UTC (permalink / raw)
To: Eric Biggers; +Cc: fstests, Eric Biggers
In-Reply-To: <1482343592-135031-2-git-send-email-ebiggers3@gmail.com>
On Wed, Dec 21, 2016 at 10:06:28AM -0800, Eric Biggers wrote:
> +build your own image, you must first build a 64-bit (amd64) xfstests
> +tarball as described in the [instructions for building
> +xfstests](building-xfstests.md). Then copy any additional Debian
> +packages, for the amd64 architecture, you want to include in the GCE
> +image into the root directory of GS_BUCKET.
This is phrased a bit awkwardly. The official way is to put the
debian packages in kvm-xfstests/test-appliances/debs. This works for
both building gce-xfstests and kvm-xfstests images.
And in general, you would need to use whatever debian packages for
whatever architecture is compatible for the image or chroot tarball
you are building. For gce-xfstests, it is always amd64, since GCE
currently only supports 64-bit x86. (But for kvm-xfstests or chroot
tarballs, it might be i386 or armhf.)
So how about,
If you want to include any additional Debian packages, or you want
to override the default Jessie packages with newer versions from
jessie-backports, place them in the directory
kvm-xfstests/test-appliances/debs. For gce-xfstests, the packages
must be for the amd64 architecture.
We might want break up the paragraph into multiple smaller paragraphs
just to make it easier to read.
- Ted
^ permalink raw reply
* Re: [PATCH v2] xfstests-bld: correct file permissions on test appliance files
From: Theodore Ts'o @ 2016-12-22 16:55 UTC (permalink / raw)
To: Eric Biggers; +Cc: fstests, Eric Biggers
In-Reply-To: <1482343592-135031-1-git-send-email-ebiggers3@gmail.com>
On Wed, Dec 21, 2016 at 10:06:27AM -0800, Eric Biggers wrote:
> From: Eric Biggers <ebiggers@google.com>
>
> The xfstests-bld repository may have been cloned with a umask that
> masked out the other bits. When using --update-files in this situation
> or when creating a GCE image, the VM ended up in a state where non-root
> users were unable to execute anything, which made all tests using the
> fsgqa user get skipped. Fix this by copying the r and x group bits to
> the other bits when creating files.tar.gz. Also set the owner and group
> to root while we're at it.
Wouldn't it be better to use "--mode=go+u-w"? This will solve the
problem for those people who use a umask of 077.
- Ted
^ permalink raw reply
* [PATCH -v2] overlay: stress test changes to top and bottom layers simultaneously
From: Theodore Ts'o @ 2016-12-22 16:43 UTC (permalink / raw)
To: fstests; +Cc: linux-unionfs, Theodore Ts'o
Introduce a test which runs fsstress on the top and bottom overlayfs
directories simultaneously to find potential races that plagued wrapfs
derived file systems.
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
---
tests/overlay/019 | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/overlay/019.out | 2 ++
tests/overlay/group | 1 +
3 files changed, 84 insertions(+)
create mode 100644 tests/overlay/019
create mode 100644 tests/overlay/019.out
diff --git a/tests/overlay/019 b/tests/overlay/019
new file mode 100644
index 00000000..1daf830f
--- /dev/null
+++ b/tests/overlay/019
@@ -0,0 +1,81 @@
+#! /bin/bash
+# FS QA Test 019
+#
+# Run fsstress on lower dir and top dir at the same time
+#
+
+seq=`basename $0`
+seqres=$RESULT_DIR/$seq
+echo "QA output created by $seq"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+_supported_fs overlay
+_supported_os Linux
+_require_scratch
+
+# Remove all files from previous tests
+_scratch_mkfs
+
+lowerdir=$SCRATCH_DEV/$OVERLAY_LOWER_DIR
+mkdir -p $lowerdir
+
+_scratch_mount
+
+echo "Silence is golden"
+
+d_low=$lowerdir/fsstress
+d_top=$SCRATCH_MNT/fsstress
+mkdir -p $d_low $d_top
+
+echo $FSSTRESS_PROG -s 42 -d $d_low -p 4 -n 1000 -l100 -v > $seqres.full.1
+$FSSTRESS_PROG -s 42 -d $d_low -p 4 -n 1000 -l100 -v >> $seqres.full.1 2>&1 &
+
+echo $FSSTRESS_PROG -s 42 -d $d_top -p 4 -n 1000 -l100 -v > $seqres.full.2
+$FSSTRESS_PROG -s 42 -d $d_top -p 4 -n 1000 -l100 -v >> $seqres.full.2 2>&1 &
+
+ret=0
+if ! wait %1
+then
+ echo "--------------------------------------" >>$seqres.full.1
+ echo "fsstress on lower directory returned $? - see $seqres.full.1"
+ echo "--------------------------------------" >>$seqres.full.1
+ ret=1
+fi
+
+if ! wait %2
+then
+ echo "--------------------------------------" >>$seqres.full.2
+ echo "fsstress on overlay directory returned $? - see $seqres.full.2"
+ echo "--------------------------------------" >>$seqres.full.2
+ ret=1
+fi
+
+cat $seqres.full.1 $seqres.full.2 > $seqres.full
+rm $seqres.full.1 $seqres.full.2
+
+if [ "$ret" -eq 1 ]
+then
+ status=1
+else
+ status=0
+fi
+
+exit $status
diff --git a/tests/overlay/019.out b/tests/overlay/019.out
new file mode 100644
index 00000000..163484bc
--- /dev/null
+++ b/tests/overlay/019.out
@@ -0,0 +1,2 @@
+QA output created by 019
+Silence is golden
diff --git a/tests/overlay/group b/tests/overlay/group
index 74822cbf..f8de84be 100644
--- a/tests/overlay/group
+++ b/tests/overlay/group
@@ -21,3 +21,4 @@
016 auto quick copyup
017 auto quick copyup
018 auto quick copyup
+019 quick stress
--
2.11.0.rc0.7.gbe5a750
^ permalink raw reply related
* [PATCH] fstests: btrfs: Test scrub and replace race for RAID56
From: Qu Wenruo @ 2016-12-22 2:02 UTC (permalink / raw)
To: linux-btrfs, fstests
Although by design, btrfs scrub and replace share the same code path, so
they are exclusive to each other.
But the fact is, there is still some critical region not protected well,
so we can have the following kernel panic, especially easy to trigger on
RAID5/6 profiles.
general protection fault: 0000 [#1] SMP
Call Trace:
[<ffffffff813a4caf>] ? generic_make_request+0xcf/0x290
[<ffffffff813a4c04>] generic_make_request+0x24/0x290
[<ffffffff813a4caf>] ? generic_make_request+0xcf/0x290
[<ffffffff813a4ede>] submit_bio+0x6e/0x120
[<ffffffffa021f7d0>] ? rbio_orig_end_io+0x80/0x80 [btrfs]
[<ffffffffa021fe31>] finish_rmw+0x401/0x550 [btrfs]
[<ffffffffa0220fc6>] validate_rbio_for_rmw+0x36/0x40 [btrfs]
[<ffffffffa022104d>] raid_rmw_end_io+0x7d/0x90 [btrfs]
[<ffffffff8139c4e6>] bio_endio+0x56/0x60
[<ffffffffa0192e5c>] end_workqueue_fn+0x3c/0x40 [btrfs]
[<ffffffffa01d45bf>] btrfs_scrubparity_helper+0xef/0x610 [btrfs]
[<ffffffffa01d4b9e>] btrfs_endio_raid56_helper+0xe/0x10 [btrfs]
[<ffffffff810ec8df>] process_one_work+0x2af/0x720
[<ffffffff810ec85b>] ? process_one_work+0x22b/0x720
[<ffffffff810ecd9b>] worker_thread+0x4b/0x4f0
[<ffffffff810ecd50>] ? process_one_work+0x720/0x720
[<ffffffff810ecd50>] ? process_one_work+0x720/0x720
[<ffffffff810f39d3>] kthread+0xf3/0x110
[<ffffffff810f38e0>] ? kthread_park+0x60/0x60
[<ffffffff818578c7>] ret_from_fork+0x27/0x40
RIP [<ffffffff813a2f58>] generic_make_request_checks+0x198/0x5a0
RSP <ffffc90001e37b08>
---[ end trace f48aec343095cd83 ]---
Since it's a racy panic, the reproducibility may var on different
platforms.
In my physical test machine, it takes less than 10s to trigger panic,
while in my VM, it takes about 40~60s for one panic,
So this test case uses TIME_FACTOR to meet different needs.
Signed-off-by: Qu Wenruo <quwenruo@cn.fujitsu.com>
---
tests/btrfs/133 | 126 ++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/btrfs/133.out | 2 +
tests/btrfs/group | 1 +
3 files changed, 129 insertions(+)
create mode 100755 tests/btrfs/133
create mode 100644 tests/btrfs/133.out
diff --git a/tests/btrfs/133 b/tests/btrfs/133
new file mode 100755
index 0000000..c912e40
--- /dev/null
+++ b/tests/btrfs/133
@@ -0,0 +1,126 @@
+#! /bin/bash
+# FS QA Test 133
+#
+# Test scrub and replace race for RAID5/6
+#
+# Even these 2 operations are exclusive to each other, they can still
+# cause race and trigger a NULL pointer panic for any multi-device
+# profile.
+#
+# This bug is most obvoious for RAID5/6 profiles, although other profile
+# like RAID0 can also trigger it, the possibility is quite low compared to
+# RAID5/6
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2016 Fujitsu. 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"
+
+here=`pwd`
+tmp=/tmp/$$
+status=1 # failure is the default!
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+_cleanup()
+{
+ cd /
+ rm -f $tmp.*
+}
+
+# get standard environment, filters and checks
+. ./common/rc
+. ./common/filter
+
+# remove previous $seqres.full before test
+rm -f $seqres.full
+
+# real QA test starts here
+
+# Modify as appropriate.
+_supported_fs btrfs
+_supported_os Linux
+_require_scratch_dev_pool 5
+_require_scratch_dev_pool_equal_size
+
+runtime=$((60 * $TIME_FACTOR))
+
+nr_devs=$(($(echo $SCRATCH_DEV_POOL | wc -w) - 1))
+
+run_test()
+{
+ local mkfs_opts=$1
+ local saved_scratch_dev_pool=$SCRATCH_DEV_POOL
+
+ echo "Test $mkfs_opts" >>$seqres.full
+
+ # remove the last device from the SCRATCH_DEV_POOL list so
+ # _scratch_pool_mkfs won't use all devices in pool
+ local last_dev="`echo $SCRATCH_DEV_POOL | $AWK_PROG '{print $NF}'`"
+ SCRATCH_DEV_POOL=`echo $SCRATCH_DEV_POOL | sed -e "s# *$last_dev *##"`
+ _scratch_pool_mkfs $mkfs_opts >>$seqres.full 2>&1
+ # make sure we created btrfs with desired options
+ if [ $? -ne 0 ]; then
+ echo "mkfs $mkfs_opts failed"
+ SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+ return
+ fi
+ _scratch_mount >>$seqres.full 2>&1
+ SCRATCH_DEV_POOL=$saved_scratch_dev_pool
+
+ # Fill the fs so that each device has at least 64M data
+ # This will slow down replace and increase the possibility to
+ # trigger the bug
+ _pwrite_byte 0xcdcdcdcd 0 $(($nr_devs * 64 * 1024 * 1024)) \
+ $SCRATCH_MNT/file > /dev/null 2>&1
+ sync
+
+ echo -n "Start replace worker: " >>$seqres.full
+ _btrfs_stress_replace $SCRATCH_MNT >>$seqres.full 2>&1 &
+ replace_pid=$!
+ echo "$replace_pid" >>$seqres.full
+
+ echo -n "Start scrub worker: " >>$seqres.full
+ _btrfs_stress_scrub $SCRATCH_MNT >/dev/null 2>&1 &
+ scrub_pid=$!
+ echo "$scrub_pid" >>$seqres.full
+
+ echo "Wait for $runtime seconds" >>$seqres.full
+ sleep $runtime
+ kill $replace_pid $scrub_pid
+ wait
+
+ # wait for the scrub and replace operations to finish
+ while ps aux | grep "scrub start" | grep -qv grep; do
+ sleep 1
+ done
+ while ps aux | grep "replace start" | grep -qv grep; do
+ sleep 1
+ done
+
+ _scratch_unmount
+}
+
+run_test "-d raid5 -m raid5"
+run_test "-d raid6 -m raid6"
+run_test "-d raid0 -m raid0"
+
+echo "Silence is golden"
+status=0
+exit
diff --git a/tests/btrfs/133.out b/tests/btrfs/133.out
new file mode 100644
index 0000000..e914d62
--- /dev/null
+++ b/tests/btrfs/133.out
@@ -0,0 +1,2 @@
+QA output created by 133
+Silence is golden
diff --git a/tests/btrfs/group b/tests/btrfs/group
index b4e4ff2..c02361e 100644
--- a/tests/btrfs/group
+++ b/tests/btrfs/group
@@ -135,3 +135,4 @@
130 auto clone send
131 auto quick
132 auto enospc
+133 auto scrub replace
--
2.7.4
^ permalink raw reply related
* [PATCH 2/2] common: add _require_getnextquota helper
From: Eric Sandeen @ 2016-12-22 1:24 UTC (permalink / raw)
To: Eric Sandeen, fstests
In-Reply-To: <8c91051e-8a78-cb20-d926-ea86e5b4645a@sandeen.net>
Add a helper to determine if the kernel supports
the GETNEXTQUOTA quotactl.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/common/quota b/common/quota
index d9bb8d9..d4ae861 100644
--- a/common/quota
+++ b/common/quota
@@ -109,6 +109,16 @@ _require_prjquota()
}
#
+# Do we have GETNEXTQUOTA? Querying ID 0 should work.
+#
+_require_getnextquota()
+{
+ _require_test_program "test-nextquota"
+ $here/src/test-nextquota -i 0 -u -d $SCRATCH_DEV &> $seqres.full || \
+ _notrun "No GETNEXTQUOTA support"
+}
+
+#
# ext4 (for now) is unique in that we must enable the project quota feature
# prior to mount. This is a relatively new feature ...
_scratch_enable_pquota()
diff --git a/tests/generic/244 b/tests/generic/244
index 36c632e..0c64330 100755
--- a/tests/generic/244
+++ b/tests/generic/244
@@ -59,10 +59,7 @@ _scratch_mkfs >> $seqres.full 2>&1
TYPES="u g"
MOUNT_OPTIONS="-o usrquota,grpquota"
_qmount
-
-# Ok, do we even have GETNEXTQUOTA? Querying ID 0 should work.
-$here/src/test-nextquota -i 0 -u -d $SCRATCH_DEV &> $seqres.full || \
- _notrun "No GETNEXTQUOTA support"
+_require_getnextquota
echo "Launch all quotas"
diff --git a/tests/generic/395 b/tests/generic/395
index cc4a93e..151229d 100755
--- a/tests/generic/395
+++ b/tests/generic/395
@@ -57,12 +57,8 @@ _require_scratch
_scratch_mkfs >> $seqres.full 2>&1
MOUNT_OPTIONS="-o usrquota,grpquota"
-
_qmount
-
-# Ok, do we even have GETNEXTQUOTA? Querying ID 0 should work.
-$here/src/test-nextquota -i 0 -u -d $SCRATCH_DEV &> $seqres.full || \
- _notrun "No GETNEXTQUOTA support"
+_require_getnextquota
echo "Launch all quotas"
^ permalink raw reply related
* [PATCH 1/2] generic/244: remove extra junk
From: Eric Sandeen @ 2016-12-22 1:23 UTC (permalink / raw)
To: Eric Sandeen, fstests
In-Reply-To: <8c91051e-8a78-cb20-d926-ea86e5b4645a@sandeen.net>
Lots of pointless mounting & unmounting & quotaon etc,
get rid of it.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/tests/generic/244 b/tests/generic/244
index 0b50438..36c632e 100755
--- a/tests/generic/244
+++ b/tests/generic/244
@@ -54,18 +54,11 @@ _supported_os Linux
_require_quota
_require_scratch
-scratch_unmount 2>/dev/null
_scratch_mkfs >> $seqres.full 2>&1
-_scratch_mount "-o usrquota,grpquota"
-quotacheck -u -g $SCRATCH_MNT 2>/dev/null
-quotaon $SCRATCH_MNT 2>/dev/null
-_scratch_unmount
TYPES="u g"
MOUNT_OPTIONS="-o usrquota,grpquota"
-
_qmount
-quotaon $SCRATCH_MNT 2>/dev/null
# Ok, do we even have GETNEXTQUOTA? Querying ID 0 should work.
$here/src/test-nextquota -i 0 -u -d $SCRATCH_DEV &> $seqres.full || \
^ permalink raw reply related
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox