68 lines
2.5 KiB
Diff
68 lines
2.5 KiB
Diff
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||
|
From: Brian Behlendorf <behlendorf1@llnl.gov>
|
||
|
Date: Mon, 14 May 2018 20:36:30 -0700
|
||
|
Subject: [PATCH] ZTS: Update O_TMPFILE support check
|
||
|
|
||
|
In CentOS 7.5 the kernel provided a compatibility wrapper to support
|
||
|
O_TMPFILE. This results in the test setup script correctly detecting
|
||
|
kernel support. But the ZFS module was built without O_TMPFILE
|
||
|
support due to the non-standard CentOS kernel interface.
|
||
|
|
||
|
Handle this case by updating the setup check to fail either when
|
||
|
the kernel or the ZFS module fail to provide support. The reason
|
||
|
will be clearly logged in the test results.
|
||
|
|
||
|
Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
|
||
|
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
|
||
|
Closes #7528
|
||
|
---
|
||
|
tests/zfs-tests/tests/functional/tmpfile/setup.ksh | 11 +++++++----
|
||
|
tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c | 11 ++++++-----
|
||
|
2 files changed, 13 insertions(+), 9 deletions(-)
|
||
|
|
||
|
diff --git a/tests/zfs-tests/tests/functional/tmpfile/setup.ksh b/tests/zfs-tests/tests/functional/tmpfile/setup.ksh
|
||
|
index 243a5b77..bc00a2a2 100755
|
||
|
--- a/tests/zfs-tests/tests/functional/tmpfile/setup.ksh
|
||
|
+++ b/tests/zfs-tests/tests/functional/tmpfile/setup.ksh
|
||
|
@@ -31,9 +31,12 @@
|
||
|
|
||
|
. $STF_SUITE/include/libtest.shlib
|
||
|
|
||
|
-if ! $STF_SUITE/tests/functional/tmpfile/tmpfile_test /tmp; then
|
||
|
- log_unsupported "The kernel doesn't support O_TMPFILE."
|
||
|
+DISK=${DISKS%% *}
|
||
|
+default_setup_noexit $DISK
|
||
|
+
|
||
|
+if ! $STF_SUITE/tests/functional/tmpfile/tmpfile_test $TESTDIR; then
|
||
|
+ default_cleanup_noexit
|
||
|
+ log_unsupported "The kernel/filesystem doesn't support O_TMPFILE"
|
||
|
fi
|
||
|
|
||
|
-DISK=${DISKS%% *}
|
||
|
-default_setup $DISK
|
||
|
+log_pass
|
||
|
diff --git a/tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c b/tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c
|
||
|
index 5fb67b47..91527ac5 100644
|
||
|
--- a/tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c
|
||
|
+++ b/tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c
|
||
|
@@ -36,13 +36,14 @@ main(int argc, char *argv[])
|
||
|
|
||
|
fd = open(argv[1], O_TMPFILE | O_WRONLY, 0666);
|
||
|
if (fd < 0) {
|
||
|
- /*
|
||
|
- * Only fail on EISDIR. If we get EOPNOTSUPP, that means
|
||
|
- * kernel support O_TMPFILE, but the path at argv[1] doesn't.
|
||
|
- */
|
||
|
if (errno == EISDIR) {
|
||
|
- fprintf(stderr, "kernel doesn't support O_TMPFILE\n");
|
||
|
+ fprintf(stderr,
|
||
|
+ "The kernel doesn't support O_TMPFILE\n");
|
||
|
return (1);
|
||
|
+ } else if (errno == EOPNOTSUPP) {
|
||
|
+ fprintf(stderr,
|
||
|
+ "The filesystem doesn't support O_TMPFILE\n");
|
||
|
+ return (2);
|
||
|
}
|
||
|
perror("open");
|
||
|
} else {
|