]> git.proxmox.com Git - zfsonlinux.git/blob - zfs-patches/0017-ZTS-Update-O_TMPFILE-support-check.patch
update/rebase to zfs-0.7.12 with patches from ZOL
[zfsonlinux.git] / zfs-patches / 0017-ZTS-Update-O_TMPFILE-support-check.patch
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
5
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.
10
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.
14
15 Reviewed-by: Chunwei Chen <tuxoko@gmail.com>
16 Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
17 Closes #7528
18 ---
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(-)
22
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
27 @@ -31,9 +31,12 @@
28
29 . $STF_SUITE/include/libtest.shlib
30
31 -if ! $STF_SUITE/tests/functional/tmpfile/tmpfile_test /tmp; then
32 - log_unsupported "The kernel doesn't support O_TMPFILE."
33 +DISK=${DISKS%% *}
34 +default_setup_noexit $DISK
35 +
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"
39 fi
40
41 -DISK=${DISKS%% *}
42 -default_setup $DISK
43 +log_pass
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[])
49
50 fd = open(argv[1], O_TMPFILE | O_WRONLY, 0666);
51 if (fd < 0) {
52 - /*
53 - * Only fail on EISDIR. If we get EOPNOTSUPP, that means
54 - * kernel support O_TMPFILE, but the path at argv[1] doesn't.
55 - */
56 if (errno == EISDIR) {
57 - fprintf(stderr, "kernel doesn't support O_TMPFILE\n");
58 + fprintf(stderr,
59 + "The kernel doesn't support O_TMPFILE\n");
60 return (1);
61 + } else if (errno == EOPNOTSUPP) {
62 + fprintf(stderr,
63 + "The filesystem doesn't support O_TMPFILE\n");
64 + return (2);
65 }
66 perror("open");
67 } else {