mirror of
				https://git.proxmox.com/git/mirror_zfs.git
				synced 2025-10-26 18:05:04 +03:00 
			
		
		
		
	Linux 6.12: support 3arg dequeue_signal() without task param
See torvalds/linux@a2b80ce87a. It claims the task arg is always `current`, and so it is with us, so this is a safe change to make. The only spanner is that we also support the older pre-5.17 3-arg dequeue_signal() which had different meaning, so we have to check the types to get the right one. Sponsored-by: https://despairlabs.com/sponsor/ Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Rob Norris <robn@despairlabs.com> Closes #16582
This commit is contained in:
		
							parent
							
								
									bc96b80550
								
							
						
					
					
						commit
						d6b8c17f1d
					
				| @ -15,7 +15,7 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT], [ | ||||
| 	]) | ||||
| ]) | ||||
| 
 | ||||
| AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG], [ | ||||
| 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") | ||||
| @ -23,12 +23,24 @@ AC_DEFUN([ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG], [ | ||||
| 	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 # | ||||
| 	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 # | ||||
| 	AC_MSG_CHECKING([whether dequeue_signal() takes 4 arguments]) | ||||
| 	ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal], [ | ||||
| 	ZFS_LINUX_TEST_RESULT([kthread_dequeue_signal_4arg], [ | ||||
| 		AC_MSG_RESULT(yes) | ||||
| 		AC_DEFINE(HAVE_DEQUEUE_SIGNAL_4ARG, 1, [dequeue_signal() takes 4 arguments]) | ||||
| 		AC_DEFINE(HAVE_DEQUEUE_SIGNAL_4ARG, 1, | ||||
| 		    [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_RESULT(yes) | ||||
| 			AC_DEFINE(HAVE_DEQUEUE_SIGNAL_3ARG_TASK, 1, | ||||
| 			    [dequeue_signal() takes a task argument]) | ||||
| 		], [ | ||||
| 			AC_MSG_RESULT(no) | ||||
| 		]) | ||||
| 	]) | ||||
| ]) | ||||
| 
 | ||||
| @ -43,8 +55,19 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT], [ | ||||
| 	]) | ||||
| ]) | ||||
| 
 | ||||
| AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG], [ | ||||
| 	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal], [ | ||||
| AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL], [ | ||||
| 	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_3arg_task], [ | ||||
| 		#include <linux/sched/signal.h> | ||||
| 	], [ | ||||
| 		struct task_struct *task = NULL; | ||||
| 		sigset_t *mask = NULL; | ||||
| 		kernel_siginfo_t *info = NULL; | ||||
| 		int error __attribute__ ((unused)); | ||||
| 
 | ||||
| 		error = dequeue_signal(task, mask, info); | ||||
| 	]) | ||||
| 
 | ||||
| 	ZFS_LINUX_TEST_SRC([kthread_dequeue_signal_4arg], [ | ||||
| 		#include <linux/sched/signal.h> | ||||
| 	], [ | ||||
| 		struct task_struct *task = NULL; | ||||
| @ -59,10 +82,10 @@ AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG], [ | ||||
| 
 | ||||
| AC_DEFUN([ZFS_AC_KERNEL_KTHREAD], [ | ||||
| 	ZFS_AC_KERNEL_KTHREAD_COMPLETE_AND_EXIT | ||||
| 	ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL_4ARG | ||||
| 	ZFS_AC_KERNEL_KTHREAD_DEQUEUE_SIGNAL | ||||
| ]) | ||||
| 
 | ||||
| AC_DEFUN([ZFS_AC_KERNEL_SRC_KTHREAD], [ | ||||
| 	ZFS_AC_KERNEL_SRC_KTHREAD_COMPLETE_AND_EXIT | ||||
| 	ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL_4ARG | ||||
| 	ZFS_AC_KERNEL_SRC_KTHREAD_DEQUEUE_SIGNAL | ||||
| ]) | ||||
|  | ||||
| @ -162,20 +162,22 @@ issig(void) | ||||
| 	if (!signal_pending(current)) | ||||
| 		return (0); | ||||
| 
 | ||||
| 	struct task_struct *task = current; | ||||
| 	spl_kernel_siginfo_t __info; | ||||
| 	sigset_t set; | ||||
| 	siginitsetinv(&set, 1ULL << (SIGSTOP - 1) | 1ULL << (SIGTSTP - 1)); | ||||
| 	sigorsets(&set, &task->blocked, &set); | ||||
| 	sigorsets(&set, ¤t->blocked, &set); | ||||
| 
 | ||||
| 	spin_lock_irq(&task->sighand->siglock); | ||||
| #ifdef HAVE_DEQUEUE_SIGNAL_4ARG | ||||
| 	spin_lock_irq(¤t->sighand->siglock); | ||||
| #if defined(HAVE_DEQUEUE_SIGNAL_4ARG) | ||||
| 	enum pid_type __type; | ||||
| 	if (dequeue_signal(task, &set, &__info, &__type) != 0) { | ||||
| 	if (dequeue_signal(current, &set, &__info, &__type) != 0) { | ||||
| #elif defined(HAVE_DEQUEUE_SIGNAL_3ARG_TASK) | ||||
| 	if (dequeue_signal(current, &set, &__info) != 0) { | ||||
| #else | ||||
| 	if (dequeue_signal(task, &set, &__info) != 0) { | ||||
| 	enum pid_type __type; | ||||
| 	if (dequeue_signal(&set, &__info, &__type) != 0) { | ||||
| #endif | ||||
| 		spin_unlock_irq(&task->sighand->siglock); | ||||
| 		spin_unlock_irq(¤t->sighand->siglock); | ||||
| 		kernel_signal_stop(); | ||||
| 
 | ||||
| 		/*
 | ||||
| @ -188,7 +190,7 @@ issig(void) | ||||
| 		return (0); | ||||
| 	} | ||||
| 
 | ||||
| 	spin_unlock_irq(&task->sighand->siglock); | ||||
| 	spin_unlock_irq(¤t->sighand->siglock); | ||||
| 
 | ||||
| 	return (1); | ||||
| } | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Rob Norris
						Rob Norris