1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Brian Behlendorf <behlendorf1@llnl.gov>
3 Date: Mon, 14 May 2018 20:36:30 -0700
4 Subject: [PATCH] ZTS: Update O_TMPFILE support check
6 In CentOS 7.5 the kernel provided a compatibility wrapper to support
7 O_TMPFILE. This results in the test setup script correctly detecting
8 kernel support. But the ZFS module was built without O_TMPFILE
9 support due to the non-standard CentOS kernel interface.
11 Handle this case by updating the setup check to fail either when
12 the kernel or the ZFS module fail to provide support. The reason
13 will be clearly logged in the test results.
15 Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
16 Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
19 tests/zfs-tests/tests/functional/tmpfile/setup.ksh | 11 +++++++----
20 tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c | 11 ++++++-----
21 2 files changed, 13 insertions(+), 9 deletions(-)
23 diff --git a/tests/zfs-tests/tests/functional/tmpfile/setup.ksh b/tests/zfs-tests/tests/functional/tmpfile/setup.ksh
24 index 243a5b77..bc00a2a2 100755
25 --- a/tests/zfs-tests/tests/functional/tmpfile/setup.ksh
26 +++ b/tests/zfs-tests/tests/functional/tmpfile/setup.ksh
29 . $STF_SUITE/include/libtest.shlib
31 -if ! $STF_SUITE/tests/functional/tmpfile/tmpfile_test /tmp; then
32 - log_unsupported "The kernel doesn't support O_TMPFILE."
34 +default_setup_noexit $DISK
36 +if ! $STF_SUITE/tests/functional/tmpfile/tmpfile_test $TESTDIR; then
37 + default_cleanup_noexit
38 + log_unsupported "The kernel/filesystem doesn't support O_TMPFILE"
44 diff --git a/tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c b/tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c
45 index 5fb67b47..91527ac5 100644
46 --- a/tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c
47 +++ b/tests/zfs-tests/tests/functional/tmpfile/tmpfile_test.c
48 @@ -36,13 +36,14 @@ main(int argc, char *argv[])
50 fd = open(argv[1], O_TMPFILE | O_WRONLY, 0666);
53 - * Only fail on EISDIR. If we get EOPNOTSUPP, that means
54 - * kernel support O_TMPFILE, but the path at argv[1] doesn't.
56 if (errno == EISDIR) {
57 - fprintf(stderr, "kernel doesn't support O_TMPFILE\n");
59 + "The kernel doesn't support O_TMPFILE\n");
61 + } else if (errno == EOPNOTSUPP) {
63 + "The filesystem doesn't support O_TMPFILE\n");