]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
LINUX 5.3.0: Use send_sig instead of force_sig
authorCheyenne Wills <cwills@sinenomine.net>
Fri, 9 Aug 2019 20:25:03 +0000 (14:25 -0600)
committerStephan Wiesand <stephan.wiesand@desy.de>
Fri, 6 Sep 2019 14:59:28 +0000 (10:59 -0400)
Linux 5.3.0 commit 3cf5d076fb4d48979f382bc9452765bf8b79e740 "signal
Remove task parameter from force_sig" (part of siginfo-linus branch)
changes the parameters for the Linux kernel function force_sig. See LKML
thread starting at https://lkml.org/lkml/2019/5/22/1351

According to the LKML discussion and the above commit message force_sig
is only safe to deliver a synchronous signal to the current task. To
send a signal to another task, we're supposed to use send_sig instead,
which has been available since at least linux 2.6.12-rc12.

Currently, rx_knet calls force_sig to kill the rxk_ListenerTask.  With
the Linux 5.3.0 kernel, this module fails to compile due to the above
noted changes.

Replace the force_sig call with send_sig.  In order to use send_sig, the
rxk_listener thread must allow SIGKILL and during shutdown (umount)
SIGKILL must be unblocked for the rxk_listener thread.

Note that SIGKILL is initially blocked on rxk_listener and is only
unblocked when shutting down the thread.  Having the signal blocked is
sufficient to prevent unwanted signals from reaching the rxk_listener
thread during normal operation.

Reviewed-on: https://gerrit.openafs.org/13753
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
(cherry picked from commit 2b7af1243f46496c0b5973b3fa2a6396243f7613)

Change-Id: I6eb44311fbcc63adb6ebeb85a8e076922befd645
Reviewed-on: https://gerrit.openafs.org/13788
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
src/afs/LINUX/osi_misc.c
src/afs/afs_osi.c
src/afs/afs_prototypes.h
src/rx/LINUX/rx_knet.c
src/rx/rx_kcommon.c

index 655076779a030e601c03a8d2f4e2bd6b1cc0c1ab..0e9336db66b0c590a03d752d9f9ce9b43bc90e88 100644 (file)
@@ -37,6 +37,17 @@ osi_linux_mask(void)
     SIG_UNLOCK(current);
 }
 
+void
+osi_linux_unmaskrxk(void)
+{
+    extern struct task_struct *rxk_ListenerTask;
+    /* Note this unblocks signals on the rxk_Listener
+     * thread from a thread that is stopping rxk */
+    SIG_LOCK(rxk_ListenerTask);
+    sigdelset(&rxk_ListenerTask->blocked, SIGKILL);
+    SIG_UNLOCK(rxk_ListenerTask);
+}
+
 /* LOOKUP_POSITIVE is becoming the default */
 #ifndef LOOKUP_POSITIVE
 #define LOOKUP_POSITIVE 0
index 2009d194d4da86aeae9e980ce31d19535e455519..c970ea3c1fe00f2e9c4049347b1702565d776d19 100644 (file)
@@ -138,6 +138,9 @@ afs_osi_MaskSignals(void)
 void
 afs_osi_UnmaskRxkSignals(void)
 {
+#ifdef AFS_LINUX22_ENV
+    osi_linux_unmaskrxk();
+#endif
 }
 
 /* Two hacks to try and fix afsdb */
index 3e2b0b11e70a4ca906cd88fef81873584c181404..5c7dc5affa2ff47e8d1b103612d86381d6211954 100644 (file)
@@ -643,7 +643,7 @@ extern int uiomove(char *dp, int length, uio_flag_t rw, struct uio *uiop);
 extern void osi_linux_free_inode_pages(void);
 #endif
 extern void osi_linux_mask(void);
-extern void osi_linux_unmask(void);
+extern void osi_linux_unmaskrxk(void);
 extern int setpag(cred_t ** cr, afs_uint32 pagvalue, afs_uint32 * newpag,
                  int change_parent);
 #endif
index dea64fb38804113c57e165dbedbbeef20eab42a7..9fbb563f36f48b1fcea801a5d6a524d71e351b44 100644 (file)
@@ -272,7 +272,7 @@ osi_StopListener(void)
     while (rxk_ListenerTask) {
         if (rxk_ListenerTask) {
            flush_signals(rxk_ListenerTask);
-           force_sig(SIGKILL, rxk_ListenerTask);
+           send_sig(SIGKILL, rxk_ListenerTask, 1);
        }
        if (!rxk_ListenerTask)
            break;
index 3d2314f5a1b1a5643452394fd1d12f1ddc90034a..cf2e2ded1d94804df065a8e3dfe68c69426474c2 100644 (file)
@@ -1201,6 +1201,7 @@ rxk_Listener(void)
 #ifdef AFS_LINUX20_ENV
     rxk_ListenerPid = current->pid;
     rxk_ListenerTask = current;
+    allow_signal(SIGKILL);    /* Allowed, but blocked until shutdown */
 #endif
 #ifdef AFS_SUN5_ENV
     rxk_ListenerPid = 1;       /* No PID, just a flag that we're alive */