From: Sun Ke <sunke32@huawei.com>
To: <fstests@vger.kernel.org>, <sunke32@huawei.com>
Subject: [v2] ext4: Add a test for rename with RENAME_WHITEOUT
Date: Thu, 28 Jan 2021 14:12:02 +0800 [thread overview]
Message-ID: <20210128061202.210074-1-sunke32@huawei.com> (raw)
Fill the disk space, try to create some files and rename a file, mount
again, list directory contents and triggers some errors. It is a
regression test for kernel commit 6b4b8e6b4ad8 ("ext4: ext4: fix bug for
rename with RENAME_WHITEOUT")
Signed-off-by: Sun Ke <sunke32@huawei.com>
---
v1 -> v3:
Use the original in src and modify 048.out
---
---
tests/ext4/048 | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
tests/ext4/048.out | 2 ++
tests/ext4/group | 1 +
3 files changed, 79 insertions(+)
create mode 100755 tests/ext4/048
create mode 100644 tests/ext4/048.out
diff --git a/tests/ext4/048 b/tests/ext4/048
new file mode 100755
index 00000000..0311d1a2
--- /dev/null
+++ b/tests/ext4/048
@@ -0,0 +1,76 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2021 HUAWEI. All Rights Reserved.
+#
+# FS QA Test 048
+#
+# This is a regression test for kernel patch:
+# commit 6b4b8e6b4ad8 ("ext4: ext4: fix bug for rename with RENAME_WHITEOUT")
+
+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 ext4
+_supported_fs generic
+_require_scratch
+_require_xfs_io_command "falloc"
+
+dmesg -c > /dev/null
+
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+testdir=$SCRATCH_MNT
+cd ${testdir}
+
+mkdir test
+$XFS_IO_PROG -f -c "falloc 0 128M" img >> $seqres.full
+$MKFS_EXT4_PROG img > /dev/null 2>&1
+$MOUNT_PROG img test
+
+# fill the disk space
+dd if=/dev/zero of=test/foo bs=1M count=128 > /dev/null 2>&1
+
+# create 1000 files, not all the files will be created successfully
+mkdir test/dir
+cd test/dir
+for ((i = 0; i < 1000; i++))
+do
+ touch file$i > /dev/null 2>&1
+done
+
+# try to rename, but now no space left on device
+$here/src/renameat2 -w $testdir/test/dir/file1 $testdir/test/dir/dst_file
+
+cd $testdir
+$UMOUNT_PROG test
+$MOUNT_PROG img test
+ls -l test/dir/file1 > /dev/null 2>&1
+$UMOUNT_PROG test
+
+dmesg -c | grep "deleted inode referenced"
+# success, all done
+status=0
+exit
diff --git a/tests/ext4/048.out b/tests/ext4/048.out
new file mode 100644
index 00000000..5b3990da
--- /dev/null
+++ b/tests/ext4/048.out
@@ -0,0 +1,2 @@
+QA output created by 048
+No space left on device
diff --git a/tests/ext4/group b/tests/ext4/group
index ceda2ba6..6140dd7e 100644
--- a/tests/ext4/group
+++ b/tests/ext4/group
@@ -50,6 +50,7 @@
045 auto dir
046 auto prealloc quick
047 auto quick dax
+048 other
271 auto rw quick
301 aio auto ioctl rw stress defrag
302 aio auto ioctl rw stress defrag
--
2.13.6
next reply other threads:[~2021-01-28 6:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-28 6:12 Sun Ke [this message]
2021-01-30 11:12 ` [v2] ext4: Add a test for rename with RENAME_WHITEOUT Zorro Lang
2021-02-01 6:12 ` Sun Ke
2021-02-01 10:13 ` Zorro Lang
2021-02-02 11:52 ` Sun Ke
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210128061202.210074-1-sunke32@huawei.com \
--to=sunke32@huawei.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.