Browse files

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 <>
Signed-off-by: Brian Behlendorf <>
Closes #7528
  • Loading branch information...
behlendorf authored and tonyhutter committed May 15, 2018
1 parent 30711dc commit 6bae0fd2de536c832e735b1aa75820273d599996
@@ -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."
default_setup_noexit $DISK
if ! $STF_SUITE/tests/functional/tmpfile/tmpfile_test $TESTDIR; then
log_unsupported "The kernel/filesystem doesn't support O_TMPFILE"
default_setup $DISK
@@ -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");
"The kernel doesn't support O_TMPFILE\n");
return (1);
} else if (errno == EOPNOTSUPP) {
"The filesystem doesn't support O_TMPFILE\n");
return (2);
} else {

0 comments on commit 6bae0fd

Please sign in to comment.