Skip to content

Commit

Permalink
config: user: check for <aio.h>
Browse files Browse the repository at this point in the history
And always zpool_read_label_slow() on non-conformant libcs

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Co-authored-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #13207
Closes #13254
  • Loading branch information
nabijaczleweli authored Mar 28, 2022
1 parent b61595f commit bc3f12b
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
7 changes: 7 additions & 0 deletions config/user-aio.h.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dnl #
dnl # POSIX specifies <aio.h> as part of realtime extensions,
dnl # and is missing from at least uClibc – force fallbacks there
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_AIO_H], [
ZFS_AC_FIND_SYSTEM_LIBRARY(AIO_H, [], [aio.h], [], [rt], [lio_listio])
])
2 changes: 1 addition & 1 deletion config/user-libaio.m4
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
dnl #
dnl # Check for libaio - only used for libaiot test cases.
dnl # Check for libaio - only used for mmap_libaio test cases.
dnl #
AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [
ZFS_AC_FIND_SYSTEM_LIBRARY(LIBAIO, [], [libaio.h], [], [aio], [], [user_libaio=yes], [user_libaio=no])
Expand Down
1 change: 1 addition & 0 deletions config/user.m4
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
ZFS_AC_CONFIG_USER_LIBAIO
ZFS_AC_CONFIG_USER_LIBATOMIC
ZFS_AC_CONFIG_USER_LIBFETCH
ZFS_AC_CONFIG_USER_AIO_H
ZFS_AC_CONFIG_USER_CLOCK_GETTIME
ZFS_AC_CONFIG_USER_PAM
ZFS_AC_CONFIG_USER_RUNSTATEDIR
Expand Down
6 changes: 6 additions & 0 deletions lib/libzutil/zutil_import.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
* using our derived config, and record the results.
*/

#ifdef HAVE_AIO_H
#include <aio.h>
#endif
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
Expand Down Expand Up @@ -982,6 +984,9 @@ zpool_read_label_slow(int fd, nvlist_t **config, int *num_labels)
int
zpool_read_label(int fd, nvlist_t **config, int *num_labels)
{
#ifndef HAVE_AIO_H
return (zpool_read_label_slow(fd, config, num_labels));
#else
struct stat64 statbuf;
struct aiocb aiocbs[VDEV_LABELS];
struct aiocb *aiocbps[VDEV_LABELS];
Expand Down Expand Up @@ -1104,6 +1109,7 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels)
*config = expected_config;

return (0);
#endif
}

/*
Expand Down

0 comments on commit bc3f12b

Please sign in to comment.