0001-config-user-check-for-aio.h.patch 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. From bc3f12bfac152a0c28951cec92340ba14f9ccee9 Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?=D0=BD=D0=B0=D0=B1?= <nabijaczleweli@nabijaczleweli.xyz>
  3. Date: Mon, 28 Mar 2022 19:24:22 +0200
  4. Subject: [PATCH] config: user: check for <aio.h>
  5. MIME-Version: 1.0
  6. Content-Type: text/plain; charset=UTF-8
  7. Content-Transfer-Encoding: 8bit
  8. And always zpool_read_label_slow() on non-conformant libcs
  9. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
  10. Co-authored-by: José Luis Salvador Rufo <salvador.joseluis@gmail.com>
  11. Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
  12. Closes #13207
  13. Closes #13254
  14. Upstream: https://github.com/openzfs/zfs/commit/bc3f12bfac152a0c28951cec92340ba14f9ccee9
  15. [yann.morin.1998@free.fr: backport from upstream]
  16. Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
  17. ---
  18. config/user-aio.h.m4 | 7 +++++++
  19. config/user-libaio.m4 | 2 +-
  20. config/user.m4 | 1 +
  21. lib/libzutil/zutil_import.c | 6 ++++++
  22. 4 files changed, 15 insertions(+), 1 deletion(-)
  23. create mode 100644 config/user-aio.h.m4
  24. diff --git a/config/user-aio.h.m4 b/config/user-aio.h.m4
  25. new file mode 100644
  26. index 00000000000..152c0946722
  27. --- /dev/null
  28. +++ b/config/user-aio.h.m4
  29. @@ -0,0 +1,7 @@
  30. +dnl #
  31. +dnl # POSIX specifies <aio.h> as part of realtime extensions,
  32. +dnl # and is missing from at least uClibc – force fallbacks there
  33. +dnl #
  34. +AC_DEFUN([ZFS_AC_CONFIG_USER_AIO_H], [
  35. + ZFS_AC_FIND_SYSTEM_LIBRARY(AIO_H, [], [aio.h], [], [rt], [lio_listio])
  36. +])
  37. diff --git a/config/user-libaio.m4 b/config/user-libaio.m4
  38. index 95c144d76b4..8009bd11b3e 100644
  39. --- a/config/user-libaio.m4
  40. +++ b/config/user-libaio.m4
  41. @@ -1,5 +1,5 @@
  42. dnl #
  43. -dnl # Check for libaio - only used for libaiot test cases.
  44. +dnl # Check for libaio - only used for mmap_libaio test cases.
  45. dnl #
  46. AC_DEFUN([ZFS_AC_CONFIG_USER_LIBAIO], [
  47. ZFS_AC_FIND_SYSTEM_LIBRARY(LIBAIO, [], [libaio.h], [], [aio], [], [user_libaio=yes], [user_libaio=no])
  48. diff --git a/config/user.m4 b/config/user.m4
  49. index 670820b3771..f450af47e04 100644
  50. --- a/config/user.m4
  51. +++ b/config/user.m4
  52. @@ -23,6 +23,7 @@ AC_DEFUN([ZFS_AC_CONFIG_USER], [
  53. ZFS_AC_CONFIG_USER_LIBAIO
  54. ZFS_AC_CONFIG_USER_LIBATOMIC
  55. ZFS_AC_CONFIG_USER_LIBFETCH
  56. + ZFS_AC_CONFIG_USER_AIO_H
  57. ZFS_AC_CONFIG_USER_CLOCK_GETTIME
  58. ZFS_AC_CONFIG_USER_PAM
  59. ZFS_AC_CONFIG_USER_RUNSTATEDIR
  60. diff --git a/lib/libzutil/zutil_import.c b/lib/libzutil/zutil_import.c
  61. index d7547c4249e..3744a1c3474 100644
  62. --- a/lib/libzutil/zutil_import.c
  63. +++ b/lib/libzutil/zutil_import.c
  64. @@ -47,7 +47,9 @@
  65. * using our derived config, and record the results.
  66. */
  67. +#ifdef HAVE_AIO_H
  68. #include <aio.h>
  69. +#endif
  70. #include <ctype.h>
  71. #include <dirent.h>
  72. #include <errno.h>
  73. @@ -982,6 +984,9 @@ zpool_read_label_slow(int fd, nvlist_t **config, int *num_labels)
  74. int
  75. zpool_read_label(int fd, nvlist_t **config, int *num_labels)
  76. {
  77. +#ifndef HAVE_AIO_H
  78. + return (zpool_read_label_slow(fd, config, num_labels));
  79. +#else
  80. struct stat64 statbuf;
  81. struct aiocb aiocbs[VDEV_LABELS];
  82. struct aiocb *aiocbps[VDEV_LABELS];
  83. @@ -1104,6 +1109,7 @@ zpool_read_label(int fd, nvlist_t **config, int *num_labels)
  84. *config = expected_config;
  85. return (0);
  86. +#endif
  87. }
  88. /*