From: Dave Chinner <david@fromorbit.com>
To: fstests@vger.kernel.org
Subject: [PATCH 4/4] generic: Add rudimetary RENAME_WHITEOUT test
Date: Wed, 25 Feb 2015 09:54:39 +1100 [thread overview]
Message-ID: <1424818479-10083-5-git-send-email-david@fromorbit.com> (raw)
In-Reply-To: <1424818479-10083-1-git-send-email-david@fromorbit.com>
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
next prev parent reply other threads:[~2015-02-24 22:59 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-24 22:54 [PATCH v2 0/4] fstests: sector size fixes and whiteouts Dave Chinner
2015-02-24 22:54 ` [PATCH 1/4] xfs/104: log size too small for 4k sector drives Dave Chinner
2015-02-25 16:11 ` Brian Foster
2015-02-25 22:32 ` ramdisk problems in 4.0-rc1? (was Re: [PATCH 1/4] xfs/104: log size too small for 4k sector drives) Dave Chinner
2015-02-25 23:31 ` Brian Foster
2015-02-25 23:43 ` Dave Chinner
2015-02-26 7:46 ` Boaz Harrosh
2015-02-26 17:23 ` Brian Foster
2015-03-01 8:49 ` Boaz Harrosh
2015-03-01 14:28 ` Brian Foster
2015-02-27 0:58 ` Dave Chinner
2015-03-01 8:27 ` Boaz Harrosh
2015-03-02 1:09 ` Dave Chinner
2015-03-02 9:40 ` Boaz Harrosh
2015-02-26 8:14 ` [PATCH] brd: Re-instate ram disk visibility option (part_show) Boaz Harrosh
2015-02-26 8:41 ` [PATCH] brd: Only request 4K sectors if DAX is enabled Boaz Harrosh
2015-02-26 8:48 ` Boaz Harrosh
2015-02-27 0:23 ` Dave Chinner
2015-03-01 8:30 ` Boaz Harrosh
2015-02-24 22:54 ` [PATCH 2/4] xfs: don't output mkfs sector sizes into golden output Dave Chinner
2015-02-27 18:56 ` Brian Foster
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
2015-02-24 22:54 ` Dave Chinner [this message]
2015-02-27 18:57 ` [PATCH 4/4] generic: Add rudimetary RENAME_WHITEOUT test Brian Foster
-- strict thread matches above, loose matches on Subject: below --
2015-02-24 7:20 [PATCH 0/4] fstests: sector size fixes and whiteouts Dave Chinner
2015-02-24 7:20 ` [PATCH 4/4] generic: Add rudimetary RENAME_WHITEOUT test Dave Chinner
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=1424818479-10083-5-git-send-email-david@fromorbit.com \
--to=david@fromorbit.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox