Linux 5.3 removed the task parameter for force_sig()
signal: Remove task parameter from force_sig
When force_sig() is not available reset the target thread
default handler to SIG_DFL and proceed to use send_sig(..., 1)
which eventually marshals the same signal to the target task.
kernel-commit:
3cf5d076fb4d48979f382bc9452765bf8b79e740
NOTE: force_sig() is used here instead of a wake_up_process() as tasks
may be blocked on rpc activity.
Test-Parameters: trivial
Cray-bug-id: LUS-7689
Signed-off-by: Shaun Tancheff <stancheff@cray.com>
Change-Id: Ic28f604d985f7e6c3c3dea8bc284c6f2e212f45c
Reviewed-on: https://review.whamcloud.com/35745
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Petros Koutoupis <pkoutoupis@cray.com>
Reviewed-by: Neil Brown <neilb@suse.de>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
]) # LIBCFS_HAVE_IOV_ITER_TYPE
#
+# LIBCFS_FORCE_SIG_WITH_TASK
+#
+# kernel 5.3 commit 3cf5d076fb4d48979f382bc9452765bf8b79e740
+# signal: Remove task parameter from force_sig
+#
+AC_DEFUN([LIBCFS_FORCE_SIG_WITH_TASK], [
+tmp_flags="$EXTRA_KCFLAGS"
+EXTRA_KCFLAGS="-Werror"
+LB_CHECK_COMPILE([if force_sig has task parameter],
+force_sig_with_task, [
+ #include <linux/sched/signal.h>
+],[
+ force_sig(SIGINT, NULL);
+],[
+ AC_DEFINE(HAVE_FORCE_SIG_WITH_TASK, 1,
+ [force_sig() has task parameter])
+])
+EXTRA_KCFLAGS="$tmp_flags"
+]) # LIBCFS_FORCE_SIG_WITH_TASK
+
+#
# LIBCFS_PROG_LINUX
#
# LibCFS linux kernel checks
LIBCFS_HAVE_IOV_ITER_TYPE
# 5.0
LIBCFS_MM_TOTALRAM_PAGES_FUNC
+# 5.3
+LIBCFS_FORCE_SIG_WITH_TASK
]) # LIBCFS_PROG_LINUX
#
#endif
#endif
+#ifdef HAVE_FORCE_SIG_WITH_TASK
+#define cfs_force_sig(sig, task) force_sig((sig), (task))
+#else
+#define cfs_force_sig(sig, task) \
+do { \
+ unsigned long flags; \
+ \
+ spin_lock_irqsave(&task->sighand->siglock, flags); \
+ task->sighand->action[sig - 1].sa.sa_handler = SIG_DFL; \
+ send_sig(sig, task, 1); \
+ spin_unlock_irqrestore(&task->sighand->siglock, flags); \
+} while (0)
+#endif
+
/* need both kernel and user-land acceptor */
#define LNET_ACCEPTOR_MIN_RESERVED_PORT 512
#define LNET_ACCEPTOR_MAX_RESERVED_PORT 1023
thread_set_flags(thread, SVC_STOPPING);
LASSERT(lfsck->li_task != NULL);
- force_sig(SIGINT, lfsck->li_task);
+ cfs_force_sig(SIGINT, lfsck->li_task);
if (lfsck->li_master) {
struct lfsck_component *com;
lad = com->lc_data;
spin_lock(&lad->lad_lock);
if (lad->lad_task != NULL)
- force_sig(SIGINT, lad->lad_task);
+ cfs_force_sig(SIGINT, lad->lad_task);
spin_unlock(&lad->lad_lock);
}
lad = com->lc_data;
spin_lock(&lad->lad_lock);
if (lad->lad_task != NULL)
- force_sig(SIGINT, lad->lad_task);
+ cfs_force_sig(SIGINT, lad->lad_task);
spin_unlock(&lad->lad_lock);
}
}