* [PATCH 0/4] fstests: sector size fixes and whiteouts...
@ 2015-02-24 7:20 Dave Chinner
2015-02-24 7:20 ` [PATCH 1/4] xfs/104: log size too small for 4k sector drives Dave Chinner
` (3 more replies)
0 siblings, 4 replies; 7+ messages in thread
From: Dave Chinner @ 2015-02-24 7:20 UTC (permalink / raw)
To: fstests
Hi folks,
The first 2 patches are fallout from a kernel change in 4.0-rc1
which changes the physical block size of a ram disk (/dev/ram0) from
512 bytes to 4kB. This bit several tests because it means mkfs.xfs
generates different geometry and so has different output.
The third patch addresses another new issue - it appears that loop
device tardown is much faster than it's ever been and so it
triggering races with unmount trying to tear down it down. unmount
is being a sore loser and so tests are failing randomly.
The final patch is a test for RENAME_WHITEOUT. I have no idea if it
encodes correct behaviour because the behaviour is completely
undocumented. So I've simply made a test that exercises ext4's
behaviour and I'm using that to verify the new XFS code matches the
same userspace visible behaviour as ext4.
-Dave.
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] xfs/104: log size too small for 4k sector drives
2015-02-24 7:20 [PATCH 0/4] fstests: sector size fixes and whiteouts Dave Chinner
@ 2015-02-24 7:20 ` Dave Chinner
2015-02-24 7:20 ` [PATCH 2/4] xfs: don't output mkfs sector sizes into golden output Dave Chinner
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Dave Chinner @ 2015-02-24 7:20 UTC (permalink / raw)
To: fstests
From: Dave Chinner <dchinner@redhat.com>
xfs/104, xfs/119 and xfs/291 have small fixed log sizes. A recent
change to the kernel ramdisk changed it's physical sector size from
512B to 4kB, and this results in mkfs calculating a log size larger
than the fixed test size and hence the tests fail.
Change the log size to a larger size that works with 4k sectors, and
also increase the size of the filesystem being created so that the
amount of data space in the filesystem does not change and hence
does not perturb the rest of the test.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
tests/xfs/104 | 8 ++++----
tests/xfs/104.out | 46 +++++++++++++++++++++++-----------------------
tests/xfs/119 | 2 +-
tests/xfs/291 | 2 +-
4 files changed, 29 insertions(+), 29 deletions(-)
diff --git a/tests/xfs/104 b/tests/xfs/104
index 69fcc69..ca2ae21 100755
--- a/tests/xfs/104
+++ b/tests/xfs/104
@@ -81,10 +81,10 @@ modsize=`expr 4 \* $incsize` # pause after this many increments
[ `expr $endsize / $dbsize` -lt $dblocks ] || _notrun "Scratch device too small"
nags=4
-size=`expr 120 \* 1048576` # 120 megabytes initially
+size=`expr 125 \* 1048576` # 120 megabytes initially
sizeb=`expr $size / $dbsize` # in data blocks
echo "*** creating scratch filesystem"
-_create_scratch -lsize=5m -dsize=${size} -dagcount=${nags}
+_create_scratch -lsize=10m -dsize=${size} -dagcount=${nags}
fillsize=`expr 110 \* 1048576` # 110 megabytes of filling
echo "*** using some initial space on scratch filesystem"
@@ -95,13 +95,13 @@ _fill_scratch $fillsize
# Kick off more stress threads on each iteration, grow; repeat.
#
while [ $size -le $endsize ]; do
- echo "*** stressing a ${size} byte filesystem"
+ echo "*** stressing filesystem"
echo "*** stressing a ${sizeb} block filesystem" >> $seqres.full
_stress_scratch
sleep 1
size=`expr $size + $incsize`
sizeb=`expr $size / $dbsize` # in data blocks
- echo "*** growing to a ${size} byte filesystem"
+ echo "*** growing filesystem"
echo "*** growing to a ${sizeb} block filesystem" >> $seqres.full
xfs_growfs -D ${sizeb} $SCRATCH_MNT \
| tee -a $seqres.full | _filter_mkfs 2>$tmp.growfs
diff --git a/tests/xfs/104.out b/tests/xfs/104.out
index f237e5e..de6c7f2 100644
--- a/tests/xfs/104.out
+++ b/tests/xfs/104.out
@@ -15,8 +15,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
*** mount
*** using some initial space on scratch filesystem
-*** stressing a 125829120 byte filesystem
-*** growing to a 169869312 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -25,8 +25,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=4
-*** stressing a 169869312 byte filesystem
-*** growing to a 213909504 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -35,8 +35,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=6
-*** stressing a 213909504 byte filesystem
-*** growing to a 257949696 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -45,8 +45,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=7
-*** stressing a 257949696 byte filesystem
-*** growing to a 301989888 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -55,8 +55,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=9
-*** stressing a 301989888 byte filesystem
-*** growing to a 346030080 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -65,8 +65,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=10
-*** stressing a 346030080 byte filesystem
-*** growing to a 390070272 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -75,8 +75,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=11
-*** stressing a 390070272 byte filesystem
-*** growing to a 434110464 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -85,8 +85,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=13
-*** stressing a 434110464 byte filesystem
-*** growing to a 478150656 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -95,18 +95,18 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=14
-*** stressing a 478150656 byte filesystem
-*** growing to a 522190848 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
naming =VERN bsize=XXX
log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
-AGCOUNT=16
+AGCOUNT=15
-*** stressing a 522190848 byte filesystem
-*** growing to a 566231040 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
@@ -115,8 +115,8 @@ log =LDEV bsize=XXX blocks=XXX
realtime =RDEV extsz=XXX blocks=XXX, rtextents=XXX
AGCOUNT=17
-*** stressing a 566231040 byte filesystem
-*** growing to a 610271232 byte filesystem
+*** stressing filesystem
+*** growing filesystem
meta-data=DDEV isize=XXX agcount=N, agsize=XXX blks
data = bsize=XXX blocks=XXX, imaxpct=PCT
= sunit=XXX swidth=XXX, unwritten=X
diff --git a/tests/xfs/119 b/tests/xfs/119
index c7c46d9..490495b 100755
--- a/tests/xfs/119
+++ b/tests/xfs/119
@@ -54,7 +54,7 @@ _require_scratch
# this may hang
sync
-export MKFS_OPTIONS="-l version=2,size=1200b,su=64k"
+export MKFS_OPTIONS="-l version=2,size=2500b,su=64k"
export MOUNT_OPTIONS="-o logbsize=64k"
_scratch_mkfs_xfs >/dev/null
diff --git a/tests/xfs/291 b/tests/xfs/291
index fbf9c51..c226e65 100755
--- a/tests/xfs/291
+++ b/tests/xfs/291
@@ -46,7 +46,7 @@ _supported_os IRIX Linux
# real QA test starts here
rm -f $seqres.full
_require_scratch
-_scratch_mkfs_xfs -n size=16k -l size=5m -d size=128m >> $seqres.full 2>&1
+_scratch_mkfs_xfs -n size=16k -l size=10m -d size=133m >> $seqres.full 2>&1
_scratch_mount
# First we cause very badly fragmented freespace, then
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] xfs: don't output mkfs sector sizes into golden output
2015-02-24 7:20 [PATCH 0/4] fstests: sector size fixes and whiteouts Dave Chinner
2015-02-24 7:20 ` [PATCH 1/4] xfs/104: log size too small for 4k sector drives Dave Chinner
@ 2015-02-24 7:20 ` Dave Chinner
2015-02-24 7:20 ` [PATCH 3/4] xfs/049: umount -d fails when kernel wins teardown race Dave Chinner
2015-02-24 7:20 ` [PATCH 4/4] generic: Add rudimetary RENAME_WHITEOUT test Dave Chinner
3 siblings, 0 replies; 7+ messages in thread
From: Dave Chinner @ 2015-02-24 7:20 UTC (permalink / raw)
To: fstests
From: Dave Chinner <dchinner@redhat.com>
The mkfs sector sizes are dependent on the underlying device in use,
and so is not fixed. hence it needs to be filtered from any golden
output file, otherwise tests that just differ by sector size will
fail.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
tests/xfs/096 | 5 +++--
tests/xfs/206 | 33 +++++++++++++++------------------
2 files changed, 18 insertions(+), 20 deletions(-)
diff --git a/tests/xfs/096 b/tests/xfs/096
index 0ecf88f..d216aa2 100755
--- a/tests/xfs/096
+++ b/tests/xfs/096
@@ -63,7 +63,7 @@ _cleanup()
# = sunit=0 blks
# realtime =none extsz=65536 blocks=N, rtextents=N
#
-_mkfs_filter()
+mkfs_filter()
{
tee -a $seqres.full | \
sed \
@@ -80,6 +80,7 @@ _mkfs_filter()
-e '/ *= *mmr=[0-9][0-9]* *$/d' \
-e 's/ *mixed-case=[YN]//' \
-e 's/ *ascii-ci=[01]//' \
+ -e "s/\(sunit=\)\([0-9]* blks,\)/\11 blks,/" \
-e 's/sectsz=[0-9][0-9]* *//' \
-e 's/, lazy-count.*//' \
-e '/inode-paths/d' \
@@ -145,7 +146,7 @@ do
fi
echo "--- mkfs=$mkfs ---"
export MKFS_OPTIONS="$mkfs"
- _scratch_mkfs_xfs 2>&1 | _mkfs_filter
+ _scratch_mkfs_xfs 2>&1 | mkfs_filter
echo ""
echo ""
done
diff --git a/tests/xfs/206 b/tests/xfs/206
index f6dcca6..198e413 100755
--- a/tests/xfs/206
+++ b/tests/xfs/206
@@ -73,34 +73,31 @@ echo "=== truncate file ==="
dd if=/dev/zero of=$tmpfile bs=1 seek=19998630180864 count=1 >/dev/null 2>&1 \
|| _fail "!!! failed to truncate loopback file to correct size"
+mkfs_filter()
+{
+ sed -e "s,^meta-data=.*isize,meta-data=FILE isize,g" \
+ -e "s/\(^log.*blocks=\)\([0-9]*,\)/\1XXXXX,/" \
+ -e "s/, projid32bit=[0-9]//" \
+ -e "s/ ftype=[0-9]//" \
+ -e "s/\(sectsz\)\(=[0-9]* *\)/\1=512 /" \
+ -e "s/\(sunit=\)\([0-9]* blks,\)/\10 blks,/" \
+ -e "/.*crc=/d"
+}
+
# mkfs slightly smaller than that
echo "=== mkfs.xfs ==="
-mkfs.xfs -f -bsize=4096 -dagsize=76288719b,size=3905982455b -llazy-count=0 $tmpfile \
- | sed -e "s,^meta-data=.*isize,meta-data=FILE isize,g" \
- -e "s/\(^log.*blocks=\)\([0-9]*,\)/\1XXXXX,/" \
- -e "s/, projid32bit=[0-9]//" \
- -e "s/ ftype=[0-9]//" \
- -e "/.*crc=/d"
+mkfs.xfs -f -bsize=4096 -dagsize=76288719b,size=3905982455b \
+ -llazy-count=0 $tmpfile | mkfs_filter
mount -o loop $tmpfile $tmpdir || _fail "!!! failed to loopback mount"
# see what happens when we growfs it
echo "=== xfs_growfs ==="
-xfs_growfs $tmpdir \
- | sed -e "s,^meta-data=.*isize,meta-data=FILE isize,g" \
- -e "s/\(^log.*blocks=\)\([0-9]*,\)/\1XXXXX,/" \
- -e "s/, projid32bit=[0-9]//" \
- -e "s/ ftype=[0-9]//" \
- -e "/.*crc=/d"
+xfs_growfs $tmpdir | mkfs_filter
# and double-check the new geometry
echo "=== xfs_info ==="
-xfs_info $tmpdir \
- | sed -e "s,^meta-data=.*isize,meta-data=FILE isize,g" \
- -e "s/\(^log.*blocks=\)\([0-9]*,\)/\1XXXXX,/" \
- -e "s/, projid32bit=[0-9]//" \
- -e "s/ ftype=[0-9]//" \
- -e "/.*crc=/d"
+xfs_info $tmpdir | mkfs_filter
# _cleanup cleans up for us
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] xfs/049: umount -d fails when kernel wins teardown race
2015-02-24 7:20 [PATCH 0/4] fstests: sector size fixes and whiteouts Dave Chinner
2015-02-24 7:20 ` [PATCH 1/4] xfs/104: log size too small for 4k sector drives Dave Chinner
2015-02-24 7:20 ` [PATCH 2/4] xfs: don't output mkfs sector sizes into golden output Dave Chinner
@ 2015-02-24 7:20 ` Dave Chinner
2015-02-24 7:20 ` [PATCH 4/4] generic: Add rudimetary RENAME_WHITEOUT test Dave Chinner
3 siblings, 0 replies; 7+ messages in thread
From: Dave Chinner @ 2015-02-24 7:20 UTC (permalink / raw)
To: fstests
From: Dave Chinner <dchinner@redhat.com>
When /etc/mtab is linked to /proc/mounts and we are using mount time
created loop devices (i.e. mount -o loop), the unmount can fail
with this amazingly informative error message:
umount: /mnt/scratch/test2: filesystem was unmounted, but mount(8) failed: Invalid argument
What it actually means in this case is that the kernel tore down the
loop device when the last reference went away, and it did it so fast
that mount was not able to find it in /etc/mtab after the unmount
syscall. Hence it could not find the loop device it was supposed to
tear down and has a hissy fit.
This is simple to fix: mount does not need to tear down the loop
device as the kernel does it automatically. Remove the "-d" from
the umount command, and the test passes again.
There's quite a few other tests that also use umount -d - fix them
as well.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
tests/xfs/049 | 8 ++++----
tests/xfs/073 | 6 +++---
tests/xfs/078 | 4 ++--
tests/xfs/216 | 2 +-
tests/xfs/217 | 2 +-
tests/xfs/250 | 4 ++--
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/tests/xfs/049 b/tests/xfs/049
index 04c2c75..8d4e074 100755
--- a/tests/xfs/049
+++ b/tests/xfs/049
@@ -29,8 +29,8 @@ echo "QA output created by $seq"
_cleanup()
{
cd /
- umount -d $SCRATCH_MNT/test2 > /dev/null 2>&1
- umount -d $SCRATCH_MNT/test > /dev/null 2>&1
+ umount $SCRATCH_MNT/test2 > /dev/null 2>&1
+ umount $SCRATCH_MNT/test > /dev/null 2>&1
rm -f $tmp.*
if [ -w $seqres.full ]
@@ -123,11 +123,11 @@ rm -rf $SCRATCH_MNT/test/* >> $seqres.full 2>&1 \
|| _fail "!!! clean failed"
_log "umount ext2 on xfs"
-umount -d $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
+umount $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
|| _fail "!!! umount ext2 failed"
_log "umount xfs"
-umount -d $SCRATCH_MNT/test >> $seqres.full 2>&1 \
+umount $SCRATCH_MNT/test >> $seqres.full 2>&1 \
|| _fail "!!! umount xfs failed"
echo "--- mounts at end (before cleanup)" >> $seqres.full
diff --git a/tests/xfs/073 b/tests/xfs/073
index f955771..38ed2cb 100755
--- a/tests/xfs/073
+++ b/tests/xfs/073
@@ -41,9 +41,9 @@ _cleanup()
{
cd /
umount $SCRATCH_MNT 2>/dev/null
- umount -d $imgs.loop 2>/dev/null
+ umount $imgs.loop 2>/dev/null
[ -d $imgs.loop ] && rmdir $imgs.loop
- umount -d $imgs.source_dir 2>/dev/null
+ umount $imgs.source_dir 2>/dev/null
[ -d $imgs.source_dir ] && rm -rf $imgs.source_dir
rm -f $imgs.* $tmp.* /var/tmp/xfs_copy.log.*
}
@@ -119,7 +119,7 @@ _verify_copy()
echo unmounting and removing new image
umount $source_dir
- umount -d $target_dir > /dev/null 2>&1
+ umount $target_dir > /dev/null 2>&1
rm -f $target
}
diff --git a/tests/xfs/078 b/tests/xfs/078
index f859efc..d8cb919 100755
--- a/tests/xfs/078
+++ b/tests/xfs/078
@@ -36,7 +36,7 @@ _cleanup()
{
cd /
rm -f $tmp.*
- umount -d $LOOP_MNT 2>/dev/null
+ umount $LOOP_MNT 2>/dev/null
rmdir $LOOP_MNT
}
@@ -97,7 +97,7 @@ _grow_loop()
$XFS_GROWFS_PROG $LOOP_MNT 2>&1 | _filter_growfs 2>&1
echo "*** unmount"
- umount -d $LOOP_MNT > /dev/null 2>&1
+ umount $LOOP_MNT > /dev/null 2>&1
# Large grows takes forever to check..
if [ "$check" -gt "0" ]
diff --git a/tests/xfs/216 b/tests/xfs/216
index 8513479..76f79ca 100755
--- a/tests/xfs/216
+++ b/tests/xfs/216
@@ -60,7 +60,7 @@ _do_mkfs()
-d name=$LOOP_DEV,size=${i}g |grep log
mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
echo "test write" > $LOOP_MNT/test
- umount -d $LOOP_MNT > /dev/null 2>&1
+ umount $LOOP_MNT > /dev/null 2>&1
done
}
# make large holey file
diff --git a/tests/xfs/217 b/tests/xfs/217
index ab55a30..8aacdf9 100755
--- a/tests/xfs/217
+++ b/tests/xfs/217
@@ -62,7 +62,7 @@ _do_mkfs()
-d name=$LOOP_DEV,size=${i}g |grep log
mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
echo "test write" > $LOOP_MNT/test
- umount -d $LOOP_MNT > /dev/null 2>&1
+ umount $LOOP_MNT > /dev/null 2>&1
# punch out the previous blocks so that we keep the amount of
# disk space the test requires down to a minimum.
diff --git a/tests/xfs/250 b/tests/xfs/250
index c1622a4..0cdc382 100755
--- a/tests/xfs/250
+++ b/tests/xfs/250
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
- umount -d $LOOP_MNT 2>/dev/null
+ umount $LOOP_MNT 2>/dev/null
rm -f $LOOP_DEV
rmdir $LOOP_MNT
}
@@ -84,7 +84,7 @@ _test_loop()
xfs_io -f -c "resvsp 0 $fsize" $LOOP_MNT/foo | _filter_io
echo "*** unmount loop filesystem"
- umount -d $LOOP_MNT > /dev/null 2>&1
+ umount $LOOP_MNT > /dev/null 2>&1
echo "*** check loop filesystem"
_check_xfs_filesystem $LOOP_DEV none none
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 4/4] generic: Add rudimetary RENAME_WHITEOUT test
2015-02-24 7:20 [PATCH 0/4] fstests: sector size fixes and whiteouts Dave Chinner
` (2 preceding siblings ...)
2015-02-24 7:20 ` [PATCH 3/4] xfs/049: umount -d fails when kernel wins teardown race Dave Chinner
@ 2015-02-24 7:20 ` Dave Chinner
3 siblings, 0 replies; 7+ messages in thread
From: Dave Chinner @ 2015-02-24 7:20 UTC (permalink / raw)
To: fstests
From: Dave Chinner <dchinner@redhat.com>
There is no API documentation for RENAME_WHITEOUT. There is no
developer documentation for RENAME_WHITEOUT. There are not comments
in the overlayfs or ext4 implementation of RENAME_WHITEOUT.
Hence, this test simply tries to expose basic RENAME_WHITEOUT
behaviour from ext4 so we can reverse-engineer and verify
bug-for-bug renameat2(RENAME_WHITEOUT) ext4 compatibility.
Note: uses generic/078 just to keep out of the way of the 6-7 other
pending new tests.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
src/renameat2.c | 4 ++--
tests/generic/078 | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++
tests/generic/078.out | 51 +++++++++++++++++++++++++++++++++++++++
tests/generic/group | 1 +
4 files changed, 120 insertions(+), 2 deletions(-)
create mode 100755 tests/generic/078
create mode 100644 tests/generic/078.out
diff --git a/src/renameat2.c b/src/renameat2.c
index 5ac0936..c59ce65 100644
--- a/src/renameat2.c
+++ b/src/renameat2.c
@@ -96,9 +96,9 @@ int main(int argc, char *argv[])
* Turn EEXIST into ENOTEMPTY. E.g. XFS uses EEXIST, and that
* is also accepted by the standards.
*
- * This applies only to plain rename (flags == 0).
+ * This applies only to plain rename and RENAME_WHITEOUT
*/
- if (!flags && errno == EEXIST)
+ if (errno == EEXIST && (!flags || (flags & RENAME_WHITEOUT)))
errno = ENOTEMPTY;
perror("");
diff --git a/tests/generic/078 b/tests/generic/078
new file mode 100755
index 0000000..92ece0c
--- /dev/null
+++ b/tests/generic/078
@@ -0,0 +1,66 @@
+#! /bin/bash
+# FS QA Test No. generic/078
+#
+# Check renameat2 syscall with RENAME_WHITEOUT flag
+#
+#-----------------------------------------------------------------------
+# Copyright (c) 2014 Miklos Szeredi. 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/renameat2
+
+_supported_fs generic
+_supported_os Linux
+
+_require_test
+_requires_renameat2
+_require_test_symlinks
+
+rename_dir=$TEST_DIR/$$
+mkdir $rename_dir
+touch $rename_dir/foo $rename_dir/bar
+if ! src/renameat2 -t -w $rename_dir/foo $rename_dir/bar; then
+ rm -f $rename_dir/foo $rename_dir/bar; rmdir $rename_dir
+ _notrun "fs doesn't support RENAME_WHITEOUT"
+fi
+rm -f $rename_dir/foo $rename_dir/bar
+
+# real QA test starts here
+
+_rename_tests $rename_dir -w
+rmdir $rename_dir
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/078.out b/tests/generic/078.out
new file mode 100644
index 0000000..5d5e3a0
--- /dev/null
+++ b/tests/generic/078.out
@@ -0,0 +1,51 @@
+QA output created by 078
+samedir none/none -> No such file or directory
+samedir none/regu -> No such file or directory
+samedir none/symb -> No such file or directory
+samedir none/dire -> No such file or directory
+samedir none/tree -> No such file or directory
+samedir regu/none -> char/regu.
+samedir regu/regu -> char/regu.
+samedir regu/symb -> char/regu.
+samedir regu/dire -> Is a directory
+samedir regu/tree -> Is a directory
+samedir symb/none -> char/symb.
+samedir symb/regu -> char/symb.
+samedir symb/symb -> char/symb.
+samedir symb/dire -> Is a directory
+samedir symb/tree -> Is a directory
+samedir dire/none -> char/dire.
+samedir dire/regu -> Not a directory
+samedir dire/symb -> Not a directory
+samedir dire/dire -> char/dire.
+samedir dire/tree -> Directory not empty
+samedir tree/none -> char/tree.
+samedir tree/regu -> Not a directory
+samedir tree/symb -> Not a directory
+samedir tree/dire -> char/tree.
+samedir tree/tree -> Directory not empty
+crossdir none/none -> No such file or directory
+crossdir none/regu -> No such file or directory
+crossdir none/symb -> No such file or directory
+crossdir none/dire -> No such file or directory
+crossdir none/tree -> No such file or directory
+crossdir regu/none -> char/regu.
+crossdir regu/regu -> char/regu.
+crossdir regu/symb -> char/regu.
+crossdir regu/dire -> Is a directory
+crossdir regu/tree -> Is a directory
+crossdir symb/none -> char/symb.
+crossdir symb/regu -> char/symb.
+crossdir symb/symb -> char/symb.
+crossdir symb/dire -> Is a directory
+crossdir symb/tree -> Is a directory
+crossdir dire/none -> char/dire.
+crossdir dire/regu -> Not a directory
+crossdir dire/symb -> Not a directory
+crossdir dire/dire -> char/dire.
+crossdir dire/tree -> Directory not empty
+crossdir tree/none -> char/tree.
+crossdir tree/regu -> Not a directory
+crossdir tree/symb -> Not a directory
+crossdir tree/dire -> char/tree.
+crossdir tree/tree -> Directory not empty
diff --git a/tests/generic/group b/tests/generic/group
index f2eb87a..0f274a6 100644
--- a/tests/generic/group
+++ b/tests/generic/group
@@ -69,6 +69,7 @@
075 rw udf auto quick
076 metadata rw udf auto quick stress
077 acl attr auto enospc
+078 auto quick metadata
079 acl attr ioctl metadata auto quick
083 rw auto enospc stress
088 perms auto quick
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] xfs/049: umount -d fails when kernel wins teardown race
2015-02-24 22:54 [PATCH v2 0/4] fstests: sector size fixes and whiteouts Dave Chinner
@ 2015-02-24 22:54 ` Dave Chinner
2015-02-27 18:56 ` Brian Foster
0 siblings, 1 reply; 7+ messages in thread
From: Dave Chinner @ 2015-02-24 22:54 UTC (permalink / raw)
To: fstests
From: Dave Chinner <dchinner@redhat.com>
When /etc/mtab is linked to /proc/mounts and we are using mount time
created loop devices (i.e. mount -o loop), the unmount can fail
with this amazingly informative error message:
umount: /mnt/scratch/test2: filesystem was unmounted, but mount(8) failed: Invalid argument
What it actually means in this case is that the kernel tore down the
loop device when the last reference went away, and it did it so fast
that mount was not able to find it in /etc/mtab after the unmount
syscall. Hence it could not find the loop device it was supposed to
tear down and has a hissy fit.
This is simple to fix: mount does not need to tear down the loop
device as the kernel does it automatically. Remove the "-d" from
the umount command, and the test passes again.
There's quite a few other tests that also use umount -d - fix them
as well.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
---
tests/xfs/049 | 8 ++++----
tests/xfs/073 | 6 +++---
tests/xfs/078 | 4 ++--
tests/xfs/216 | 2 +-
tests/xfs/217 | 2 +-
tests/xfs/250 | 4 ++--
6 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/tests/xfs/049 b/tests/xfs/049
index 04c2c75..8d4e074 100755
--- a/tests/xfs/049
+++ b/tests/xfs/049
@@ -29,8 +29,8 @@ echo "QA output created by $seq"
_cleanup()
{
cd /
- umount -d $SCRATCH_MNT/test2 > /dev/null 2>&1
- umount -d $SCRATCH_MNT/test > /dev/null 2>&1
+ umount $SCRATCH_MNT/test2 > /dev/null 2>&1
+ umount $SCRATCH_MNT/test > /dev/null 2>&1
rm -f $tmp.*
if [ -w $seqres.full ]
@@ -123,11 +123,11 @@ rm -rf $SCRATCH_MNT/test/* >> $seqres.full 2>&1 \
|| _fail "!!! clean failed"
_log "umount ext2 on xfs"
-umount -d $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
+umount $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
|| _fail "!!! umount ext2 failed"
_log "umount xfs"
-umount -d $SCRATCH_MNT/test >> $seqres.full 2>&1 \
+umount $SCRATCH_MNT/test >> $seqres.full 2>&1 \
|| _fail "!!! umount xfs failed"
echo "--- mounts at end (before cleanup)" >> $seqres.full
diff --git a/tests/xfs/073 b/tests/xfs/073
index f955771..38ed2cb 100755
--- a/tests/xfs/073
+++ b/tests/xfs/073
@@ -41,9 +41,9 @@ _cleanup()
{
cd /
umount $SCRATCH_MNT 2>/dev/null
- umount -d $imgs.loop 2>/dev/null
+ umount $imgs.loop 2>/dev/null
[ -d $imgs.loop ] && rmdir $imgs.loop
- umount -d $imgs.source_dir 2>/dev/null
+ umount $imgs.source_dir 2>/dev/null
[ -d $imgs.source_dir ] && rm -rf $imgs.source_dir
rm -f $imgs.* $tmp.* /var/tmp/xfs_copy.log.*
}
@@ -119,7 +119,7 @@ _verify_copy()
echo unmounting and removing new image
umount $source_dir
- umount -d $target_dir > /dev/null 2>&1
+ umount $target_dir > /dev/null 2>&1
rm -f $target
}
diff --git a/tests/xfs/078 b/tests/xfs/078
index f859efc..d8cb919 100755
--- a/tests/xfs/078
+++ b/tests/xfs/078
@@ -36,7 +36,7 @@ _cleanup()
{
cd /
rm -f $tmp.*
- umount -d $LOOP_MNT 2>/dev/null
+ umount $LOOP_MNT 2>/dev/null
rmdir $LOOP_MNT
}
@@ -97,7 +97,7 @@ _grow_loop()
$XFS_GROWFS_PROG $LOOP_MNT 2>&1 | _filter_growfs 2>&1
echo "*** unmount"
- umount -d $LOOP_MNT > /dev/null 2>&1
+ umount $LOOP_MNT > /dev/null 2>&1
# Large grows takes forever to check..
if [ "$check" -gt "0" ]
diff --git a/tests/xfs/216 b/tests/xfs/216
index 8513479..76f79ca 100755
--- a/tests/xfs/216
+++ b/tests/xfs/216
@@ -60,7 +60,7 @@ _do_mkfs()
-d name=$LOOP_DEV,size=${i}g |grep log
mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
echo "test write" > $LOOP_MNT/test
- umount -d $LOOP_MNT > /dev/null 2>&1
+ umount $LOOP_MNT > /dev/null 2>&1
done
}
# make large holey file
diff --git a/tests/xfs/217 b/tests/xfs/217
index ab55a30..8aacdf9 100755
--- a/tests/xfs/217
+++ b/tests/xfs/217
@@ -62,7 +62,7 @@ _do_mkfs()
-d name=$LOOP_DEV,size=${i}g |grep log
mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
echo "test write" > $LOOP_MNT/test
- umount -d $LOOP_MNT > /dev/null 2>&1
+ umount $LOOP_MNT > /dev/null 2>&1
# punch out the previous blocks so that we keep the amount of
# disk space the test requires down to a minimum.
diff --git a/tests/xfs/250 b/tests/xfs/250
index c1622a4..0cdc382 100755
--- a/tests/xfs/250
+++ b/tests/xfs/250
@@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
_cleanup()
{
cd /
- umount -d $LOOP_MNT 2>/dev/null
+ umount $LOOP_MNT 2>/dev/null
rm -f $LOOP_DEV
rmdir $LOOP_MNT
}
@@ -84,7 +84,7 @@ _test_loop()
xfs_io -f -c "resvsp 0 $fsize" $LOOP_MNT/foo | _filter_io
echo "*** unmount loop filesystem"
- umount -d $LOOP_MNT > /dev/null 2>&1
+ umount $LOOP_MNT > /dev/null 2>&1
echo "*** check loop filesystem"
_check_xfs_filesystem $LOOP_DEV none none
--
2.0.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] xfs/049: umount -d fails when kernel wins teardown race
2015-02-24 22:54 ` [PATCH 3/4] xfs/049: umount -d fails when kernel wins teardown race Dave Chinner
@ 2015-02-27 18:56 ` Brian Foster
0 siblings, 0 replies; 7+ messages in thread
From: Brian Foster @ 2015-02-27 18:56 UTC (permalink / raw)
To: Dave Chinner; +Cc: fstests
On Wed, Feb 25, 2015 at 09:54:38AM +1100, Dave Chinner wrote:
> From: Dave Chinner <dchinner@redhat.com>
>
> When /etc/mtab is linked to /proc/mounts and we are using mount time
> created loop devices (i.e. mount -o loop), the unmount can fail
> with this amazingly informative error message:
>
> umount: /mnt/scratch/test2: filesystem was unmounted, but mount(8) failed: Invalid argument
>
> What it actually means in this case is that the kernel tore down the
> loop device when the last reference went away, and it did it so fast
> that mount was not able to find it in /etc/mtab after the unmount
> syscall. Hence it could not find the loop device it was supposed to
> tear down and has a hissy fit.
>
> This is simple to fix: mount does not need to tear down the loop
> device as the kernel does it automatically. Remove the "-d" from
> the umount command, and the test passes again.
>
> There's quite a few other tests that also use umount -d - fix them
> as well.
>
> Signed-off-by: Dave Chinner <dchinner@redhat.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> tests/xfs/049 | 8 ++++----
> tests/xfs/073 | 6 +++---
> tests/xfs/078 | 4 ++--
> tests/xfs/216 | 2 +-
> tests/xfs/217 | 2 +-
> tests/xfs/250 | 4 ++--
> 6 files changed, 13 insertions(+), 13 deletions(-)
>
> diff --git a/tests/xfs/049 b/tests/xfs/049
> index 04c2c75..8d4e074 100755
> --- a/tests/xfs/049
> +++ b/tests/xfs/049
> @@ -29,8 +29,8 @@ echo "QA output created by $seq"
> _cleanup()
> {
> cd /
> - umount -d $SCRATCH_MNT/test2 > /dev/null 2>&1
> - umount -d $SCRATCH_MNT/test > /dev/null 2>&1
> + umount $SCRATCH_MNT/test2 > /dev/null 2>&1
> + umount $SCRATCH_MNT/test > /dev/null 2>&1
> rm -f $tmp.*
>
> if [ -w $seqres.full ]
> @@ -123,11 +123,11 @@ rm -rf $SCRATCH_MNT/test/* >> $seqres.full 2>&1 \
> || _fail "!!! clean failed"
>
> _log "umount ext2 on xfs"
> -umount -d $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
> +umount $SCRATCH_MNT/test2 >> $seqres.full 2>&1 \
> || _fail "!!! umount ext2 failed"
>
> _log "umount xfs"
> -umount -d $SCRATCH_MNT/test >> $seqres.full 2>&1 \
> +umount $SCRATCH_MNT/test >> $seqres.full 2>&1 \
> || _fail "!!! umount xfs failed"
>
> echo "--- mounts at end (before cleanup)" >> $seqres.full
> diff --git a/tests/xfs/073 b/tests/xfs/073
> index f955771..38ed2cb 100755
> --- a/tests/xfs/073
> +++ b/tests/xfs/073
> @@ -41,9 +41,9 @@ _cleanup()
> {
> cd /
> umount $SCRATCH_MNT 2>/dev/null
> - umount -d $imgs.loop 2>/dev/null
> + umount $imgs.loop 2>/dev/null
> [ -d $imgs.loop ] && rmdir $imgs.loop
> - umount -d $imgs.source_dir 2>/dev/null
> + umount $imgs.source_dir 2>/dev/null
> [ -d $imgs.source_dir ] && rm -rf $imgs.source_dir
> rm -f $imgs.* $tmp.* /var/tmp/xfs_copy.log.*
> }
> @@ -119,7 +119,7 @@ _verify_copy()
>
> echo unmounting and removing new image
> umount $source_dir
> - umount -d $target_dir > /dev/null 2>&1
> + umount $target_dir > /dev/null 2>&1
> rm -f $target
> }
>
> diff --git a/tests/xfs/078 b/tests/xfs/078
> index f859efc..d8cb919 100755
> --- a/tests/xfs/078
> +++ b/tests/xfs/078
> @@ -36,7 +36,7 @@ _cleanup()
> {
> cd /
> rm -f $tmp.*
> - umount -d $LOOP_MNT 2>/dev/null
> + umount $LOOP_MNT 2>/dev/null
> rmdir $LOOP_MNT
> }
>
> @@ -97,7 +97,7 @@ _grow_loop()
> $XFS_GROWFS_PROG $LOOP_MNT 2>&1 | _filter_growfs 2>&1
>
> echo "*** unmount"
> - umount -d $LOOP_MNT > /dev/null 2>&1
> + umount $LOOP_MNT > /dev/null 2>&1
>
> # Large grows takes forever to check..
> if [ "$check" -gt "0" ]
> diff --git a/tests/xfs/216 b/tests/xfs/216
> index 8513479..76f79ca 100755
> --- a/tests/xfs/216
> +++ b/tests/xfs/216
> @@ -60,7 +60,7 @@ _do_mkfs()
> -d name=$LOOP_DEV,size=${i}g |grep log
> mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
> echo "test write" > $LOOP_MNT/test
> - umount -d $LOOP_MNT > /dev/null 2>&1
> + umount $LOOP_MNT > /dev/null 2>&1
> done
> }
> # make large holey file
> diff --git a/tests/xfs/217 b/tests/xfs/217
> index ab55a30..8aacdf9 100755
> --- a/tests/xfs/217
> +++ b/tests/xfs/217
> @@ -62,7 +62,7 @@ _do_mkfs()
> -d name=$LOOP_DEV,size=${i}g |grep log
> mount -o loop -t xfs $LOOP_DEV $LOOP_MNT
> echo "test write" > $LOOP_MNT/test
> - umount -d $LOOP_MNT > /dev/null 2>&1
> + umount $LOOP_MNT > /dev/null 2>&1
>
> # punch out the previous blocks so that we keep the amount of
> # disk space the test requires down to a minimum.
> diff --git a/tests/xfs/250 b/tests/xfs/250
> index c1622a4..0cdc382 100755
> --- a/tests/xfs/250
> +++ b/tests/xfs/250
> @@ -33,7 +33,7 @@ trap "_cleanup; exit \$status" 0 1 2 3 15
> _cleanup()
> {
> cd /
> - umount -d $LOOP_MNT 2>/dev/null
> + umount $LOOP_MNT 2>/dev/null
> rm -f $LOOP_DEV
> rmdir $LOOP_MNT
> }
> @@ -84,7 +84,7 @@ _test_loop()
> xfs_io -f -c "resvsp 0 $fsize" $LOOP_MNT/foo | _filter_io
>
> echo "*** unmount loop filesystem"
> - umount -d $LOOP_MNT > /dev/null 2>&1
> + umount $LOOP_MNT > /dev/null 2>&1
>
> echo "*** check loop filesystem"
> _check_xfs_filesystem $LOOP_DEV none none
> --
> 2.0.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" 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 [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-02-27 18:57 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-24 7:20 [PATCH 0/4] fstests: sector size fixes and whiteouts Dave Chinner
2015-02-24 7:20 ` [PATCH 1/4] xfs/104: log size too small for 4k sector drives Dave Chinner
2015-02-24 7:20 ` [PATCH 2/4] xfs: don't output mkfs sector sizes into golden output Dave Chinner
2015-02-24 7:20 ` [PATCH 3/4] xfs/049: umount -d fails when kernel wins teardown race Dave Chinner
2015-02-24 7:20 ` [PATCH 4/4] generic: Add rudimetary RENAME_WHITEOUT test Dave Chinner
-- strict thread matches above, loose matches on Subject: below --
2015-02-24 22:54 [PATCH v2 0/4] fstests: sector size fixes and whiteouts Dave Chinner
2015-02-24 22:54 ` [PATCH 3/4] xfs/049: umount -d fails when kernel wins teardown race Dave Chinner
2015-02-27 18:56 ` Brian Foster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox