Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

config: fix dequeue_signal check for kernels <4.20 #16666

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 22 additions & 15 deletions config/kernel-kthread.m4
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,21 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT], [

AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL], [
dnl #
dnl # 5.17 API: enum pid_type * as new 4th dequeue_signal() argument,
dnl # 5768d8906bc23d512b1a736c1e198aa833a6daa4 ("signal: Requeue signals in the appropriate queue")
dnl # prehistory:
dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask,
dnl # siginfo_t *info)
dnl #
dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, kernel_siginfo_t *info);
dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type);
dnl # 4.20: kernel_siginfo_t introduced, replaces siginfo_t
dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask,
dnl kernel_siginfo_t *info)
dnl #
dnl # 6.12 API: first arg struct_task* removed
dnl # int dequeue_signal(sigset_t *mask, kernel_siginfo_t *info, enum pid_type *type);
dnl # 5.17: enum pid_type introduced as 4th arg
dnl # int dequeue_signal(struct task_struct *task, sigset_t *mask,
dnl # kernel_siginfo_t *info, enum pid_type *type)
dnl #
dnl # 6.12: first arg struct_task* removed
dnl # int dequeue_signal(sigset_t *mask, kernel_siginfo_t *info,
dnl # enum pid_type *type)
dnl #
AC_MSG_CHECKING([whether dequeue_signal() takes 4 arguments])
ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_4arg], [
Expand All @@ -33,11 +40,11 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL], [
[dequeue_signal() takes 4 arguments])
], [
AC_MSG_RESULT(no)
AC_MSG_CHECKING([whether dequeue_signal() a task argument])
ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_3arg_task], [
AC_MSG_CHECKING([whether 3-arg dequeue_signal() takes a type argument])
ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_3arg_type], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DEQUEUE_SIGNAL_3ARG_TASK, 1,
[dequeue_signal() takes a task argument])
AC_DEFINE(HAVE_DEQUEUE_SIGNAL_3ARG_TYPE, 1,
[3-arg dequeue_signal() takes a type argument])
], [
AC_MSG_RESULT(no)
])
Expand All @@ -56,27 +63,27 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT], [
])

AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL], [
ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_3arg_task], [
ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_4arg], [
#include <linux/sched/signal.h>
], [
struct task_struct *task = NULL;
sigset_t *mask = NULL;
kernel_siginfo_t *info = NULL;
enum pid_type *type = NULL;
int error __attribute__ ((unused));

error = dequeue_signal(task, mask, info);
error = dequeue_signal(task, mask, info, type);
])

ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_4arg], [
ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_3arg_type], [
#include <linux/sched/signal.h>
], [
struct task_struct *task = NULL;
sigset_t *mask = NULL;
kernel_siginfo_t *info = NULL;
enum pid_type *type = NULL;
int error __attribute__ ((unused));

error = dequeue_signal(task, mask, info, type);
error = dequeue_signal(mask, info, type);
])
])

Expand Down
6 changes: 3 additions & 3 deletions module/os/linux/spl/spl-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,11 +171,11 @@ issig(void)
#if defined(HAVE_DEQUEUE_SIGNAL_4ARG)
enum pid_type __type;
if (dequeue_signal(current, &set, &__info, &__type) != 0) {
#elif defined(HAVE_DEQUEUE_SIGNAL_3ARG_TASK)
if (dequeue_signal(current, &set, &__info) != 0) {
#else
#elif defined(HAVE_DEQUEUE_SIGNAL_3ARG_TYPE)
enum pid_type __type;
if (dequeue_signal(&set, &__info, &__type) != 0) {
#else
if (dequeue_signal(current, &set, &__info) != 0) {
#endif
spin_unlock_irq(&current->sighand->siglock);
kernel_signal_stop();
Expand Down
Loading