LINUX: Fix includes for fatal_signal_pending test 08/14508/2
authorAndrew Deason <adeason@sinenomine.net>
Thu, 28 Jan 2021 22:59:47 +0000 (16:59 -0600)
committerBenjamin Kaduk <kaduk@mit.edu>
Fri, 29 Jan 2021 17:17:28 +0000 (12:17 -0500)
Commit 8b6ae289 (LINUX: Avoid lookup ENOENT on fatal signals) added a
configure test for fatal_signal_pending(). However, this check fails
incorrectly ever since Linux 4.11, because fatal_signal_pending() was moved
from linux/sched.h to linux/sched/signal.h in Linux commit 2a1f062a
(sched/headers: Move signal wakeup [...]). Fix this by including
linux/sched/signal.h if we have it during the configure test.

A false negative on this configure test doesn't break the build, but
it disables one of our safeguards preventing incorrect negative
dentries at runtime. The function fatal_signal_pending() hasn't
changed in quite some time (except for what header it lives in); it
was introduced in Linux 2.6.25 via Linux commit f776d12d (Add
fatal_signal_pending). So to try to avoid this mistake again in the
future, make it so a missing fatal_signal_pending() breaks the build
if we're on Linux 2.6.25+.

Change-Id: Id0b91b2f24e2ea87c9c900076ab7ab1fcab3d304
Reviewed-on: https://gerrit.openafs.org/14508
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Tested-by: BuildBot <buildbot@rampaginggeek.com>

src/afs/LINUX/osi_vnodeops.c
src/cf/linux-kernel-func.m4

index 5d1aac3..a1c6330 100644 (file)
@@ -1212,6 +1212,8 @@ filter_enoent(int code)
     if (code == ENOENT && fatal_signal_pending(current)) {
         return EINTR;
     }
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,25)
+# error fatal_signal_pending not available, but it should be
 #endif
     return code;
 }
index 10b7c97..4651b5b 100644 (file)
@@ -42,8 +42,13 @@ AC_CHECK_LINUX_FUNC([d_make_root],
 AC_CHECK_LINUX_FUNC([do_sync_read],
                     [#include <linux/fs.h>],
                     [do_sync_read(NULL, NULL, 0, NULL);])
+dnl - fatal_signal_pending introduced in 2.6.25
+dnl - moved from linux/sched.h to linux/sched/signal.h in 4.11
 AC_CHECK_LINUX_FUNC([fatal_signal_pending],
-                    [#include <linux/sched.h>],
+                    [#include <linux/sched.h>
+                     #ifdef HAVE_LINUX_SCHED_SIGNAL_H
+                     # include <linux/sched/signal.h>
+                     #endif],
                     [fatal_signal_pending(NULL);])
 AC_CHECK_LINUX_FUNC([file_dentry],
                     [#include <linux/fs.h>],