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

Linux 5.17 API updates #12989

Closed
wants to merge 3 commits into from
Closed
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
68 changes: 68 additions & 0 deletions config/kernel-kthread.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT], [
dnl #
dnl # 5.17 API,
dnl # cead18552660702a4a46f58e65188fe5f36e9dfe ("exit: Rename complete_and_exit to kthread_complete_and_exit")
dnl #
dnl # Also moves the definition from include/linux/kernel.h to include/linux/kthread.h
dnl #
AC_MSG_CHECKING([whether kthread_complete_and_exit() is available])
ZFS_LINUX_TEST_RESULT([kthread_complete_and_exit], [
AC_MSG_RESULT(yes)
AC_DEFINE(SPL_KTHREAD_COMPLETE_AND_EXIT, kthread_complete_and_exit, [kthread_complete_and_exit() available])
], [
AC_MSG_RESULT(no)
AC_DEFINE(SPL_KTHREAD_COMPLETE_AND_EXIT, complete_and_exit, [using complete_and_exit() instead])
])
])

AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
dnl #
dnl # 5.17 API: enum pid_type * as new 4th dequeue_signal() argument,
dnl # 5768d8906bc23d512b1a736c1e198aa833a6daa4 ("signal: Requeue signals in the appropriate queue")
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 #
AC_MSG_CHECKING([whether dequeue_signal() takes 4 arguments])
ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal], [
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_DEQUEUE_SIGNAL_4ARG, 1, [dequeue_signal() takes 4 arguments])
], [
AC_MSG_RESULT(no)
])
])

AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT], [
ZFS_LINUX_TEST_SRC([kthread_complete_and_exit], [
#include <linux/kthread.h>
], [
struct completion *completion = NULL;
long code = 0;

kthread_complete_and_exit(completion, code);
])
])

AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG], [
ZFS_LINUX_TEST_SRC([kthread_dequeue_signal], [
#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);
])
])

AC_DEFUN([ZFS_AC_KERNEL_KTHREAD], [
ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT
ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG
])

AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD], [
ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT
ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG
])
16 changes: 9 additions & 7 deletions config/kernel-pde-data.m4
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
dnl #
dnl # 3.10 API change,
dnl # PDE is replaced by PDE_DATA
dnl # 5.17 API: PDE_DATA() renamed to pde_data(),
dnl # 359745d78351c6f5442435f81549f0207ece28aa ("proc: remove PDE_DATA() completely")
dnl #
AC_DEFUN([ZFS_AC_KERNEL_SRC_PDE_DATA], [
ZFS_LINUX_TEST_SRC([pde_data], [
#include <linux/proc_fs.h>
], [
PDE_DATA(NULL);
pde_data(NULL);
])
])

AC_DEFUN([ZFS_AC_KERNEL_PDE_DATA], [
AC_MSG_CHECKING([whether PDE_DATA() is available])
ZFS_LINUX_TEST_RESULT_SYMBOL([pde_data], [PDE_DATA], [], [
AC_MSG_CHECKING([whether pde_data() is lowercase])
ZFS_LINUX_TEST_RESULT([pde_data], [
AC_MSG_RESULT(yes)
],[
ZFS_LINUX_TEST_ERROR([PDE_DATA])
AC_DEFINE(SPL_PDE_DATA, pde_data, [pde_data() is pde_data()])
], [
AC_MSG_RESULT(no)
AC_DEFINE(SPL_PDE_DATA, PDE_DATA, [pde_data() is PDE_DATA()])
])
])
2 changes: 2 additions & 0 deletions config/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_SRC], [
ZFS_AC_KERNEL_SRC_STANDALONE_LINUX_STDARG
ZFS_AC_KERNEL_SRC_PAGEMAP_FOLIO_WAIT_BIT
ZFS_AC_KERNEL_SRC_ADD_DISK
ZFS_AC_KERNEL_SRC_KTHREAD
AC_MSG_CHECKING([for available kernel interfaces])
ZFS_LINUX_TEST_COMPILE_ALL([kabi])
Expand Down Expand Up @@ -245,6 +246,7 @@ AC_DEFUN([ZFS_AC_KERNEL_TEST_RESULT], [
ZFS_AC_KERNEL_STANDALONE_LINUX_STDARG
ZFS_AC_KERNEL_PAGEMAP_FOLIO_WAIT_BIT
ZFS_AC_KERNEL_ADD_DISK
ZFS_AC_KERNEL_KTHREAD
])

dnl #
Expand Down
2 changes: 1 addition & 1 deletion module/os/linux/spl/spl-kstat.c
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ proc_kstat_open(struct inode *inode, struct file *filp)
return (rc);

f = filp->private_data;
f->private = PDE_DATA(inode);
f->private = SPL_PDE_DATA(inode);

return (0);
}
Expand Down
2 changes: 1 addition & 1 deletion module/os/linux/spl/spl-procfs-list.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ procfs_list_open(struct inode *inode, struct file *filp)

struct seq_file *f = filp->private_data;
procfs_list_cursor_t *cursor = f->private;
cursor->procfs_list = PDE_DATA(inode);
cursor->procfs_list = SPL_PDE_DATA(inode);
cursor->cached_node = NULL;
cursor->cached_pos = 0;

Expand Down
7 changes: 6 additions & 1 deletion module/os/linux/spl/spl-thread.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ void
__thread_exit(void)
{
tsd_exit();
complete_and_exit(NULL, 0);
SPL_KTHREAD_COMPLETE_AND_EXIT(NULL, 0);
/* Unreachable */
}
EXPORT_SYMBOL(__thread_exit);
Expand Down Expand Up @@ -188,7 +188,12 @@ issig(int why)

spin_lock_irq(&task->sighand->siglock);
int ret;
#ifdef HAVE_DEQUEUE_SIGNAL_4ARG
enum pid_type __type;
if ((ret = dequeue_signal(task, &set, &__info, &__type)) != 0) {
#else
if ((ret = dequeue_signal(task, &set, &__info)) != 0) {
#endif
#ifdef HAVE_SIGNAL_STOP
spin_unlock_irq(&task->sighand->siglock);
kernel_signal_stop();
Expand Down