summarylogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.SRCINFO26
-rw-r--r--0001-Avoid-duplicate-definitions-of-globals.patch353
-rw-r--r--0001-Temporary-fix-for-compilation-with-GCC-10.patch33
-rw-r--r--0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch6
-rw-r--r--0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch6
-rw-r--r--0004-LINUX-5.8-use-lru_cache_add.patch6
-rw-r--r--0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch169
-rw-r--r--0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch73
-rw-r--r--0007-Linux-Refactor-test-for-32bit-compat.patch212
-rw-r--r--0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch98
-rw-r--r--PKGBUILD36
11 files changed, 957 insertions, 61 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 122e0bd8ea7..63a0d33c208 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,6 +1,6 @@
pkgbase = openafs-modules-dkms
pkgdesc = Kernel module for OpenAFS (dkms)
- pkgver = 1.8.6
+ pkgver = 1.8.7
pkgrel = 2
url = http://www.openafs.org
arch = i686
@@ -10,23 +10,31 @@ pkgbase = openafs-modules-dkms
depends = dkms
depends = libelf
depends = openafs
- provides = openafs-modules=1.8.6
+ provides = openafs-modules=1.8.7
conflicts = openafs-features-libafs
conflicts = openafs-modules
conflicts = openafs<1.6.6-2
options = !emptydirs
- source = http://openafs.org/dl/openafs/1.8.6/openafs-1.8.6-src.tar.bz2
+ source = http://openafs.org/dl/openafs/1.8.7/openafs-1.8.7-src.tar.bz2
source = dkms.conf
- source = 0001-Temporary-fix-for-compilation-with-GCC-10.patch
+ source = 0001-Avoid-duplicate-definitions-of-globals.patch
source = 0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
source = 0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
source = 0004-LINUX-5.8-use-lru_cache_add.patch
- sha256sums = 8b4e9d3180f1ecd752753da17ac630df04eb7007c90a921a5f6403c0339d2945
+ source = 0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
+ source = 0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
+ source = 0007-Linux-Refactor-test-for-32bit-compat.patch
+ source = 0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch
+ sha256sums = 53543a561fce67714fec9f2a6bf408c5cc1d061c7dc9d1459458275e8ccbfa79
sha256sums = 5ea5e184f9b44f5ed45817d2b5a10149d15c8c54f49e0b5b4b773652673cb9b0
- sha256sums = 3d0bf6960ef1eaab87492e93ea36c3b1a6b1e12877863abd7b64ad78e4637bce
- sha256sums = 5c02f2c152720bc790dfdf5f99b083b986acd34074da917efa9f39265eda7483
- sha256sums = 4373b0509c1eb7f4aec4cb11a231571f1015cdf3bef6e059c0df9e493e178e83
- sha256sums = 955f710fff9f535406800406bf128deccc209511b0aa9b6aacb6f3b4417a6a4d
+ sha256sums = 89d423281ae4664467ff583d664cd014362f0f829f2bb1ef76809593626b55e0
+ sha256sums = cceb2501cca12956644718c64db1c8c0e8d460afbbde302045427f0610b60a92
+ sha256sums = 729f14132a917c2397f4dc713d31c74c0a278c7359c5dd4edc3758fb08e534c4
+ sha256sums = 73b69cea6eef193457091090fe2c6ae090040537395618dcb47c770196bc14ef
+ sha256sums = aef54d871c376648ef712e9cc224aa65ef012762a28778d53d509a72f99d174e
+ sha256sums = 38eaec2c4e08d45b4aa130ec581ed1e265950553432d8dd878f99decc54416de
+ sha256sums = c62380c6284f7da43234c7c2bea8503851cd455e0c06d688bbafb1d77cdbd476
+ sha256sums = ebb0c7ddd0fde966e35c277c7474abc39772a1bbaa601e7a678c95aad31bfb48
pkgname = openafs-modules-dkms
diff --git a/0001-Avoid-duplicate-definitions-of-globals.patch b/0001-Avoid-duplicate-definitions-of-globals.patch
new file mode 100644
index 00000000000..960bddf48a8
--- /dev/null
+++ b/0001-Avoid-duplicate-definitions-of-globals.patch
@@ -0,0 +1,353 @@
+From ac4debb46bc0b95ff2f98d416703bc8df60b8415 Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Fri, 22 May 2020 12:16:48 -0600
+Subject: [PATCH 1/8] Avoid duplicate definitions of globals
+
+GCC 10 changed a default flag from -fcommon to -fno-common. See
+https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85678 for some background.
+
+The change in gcc 10 results in build link-time errors. For example:
+ ../../src/xstat/.libs/liboafs_xstat_cm.a(xstat_cm.o):(.bss+0x2050):
+ multiple definition of `numCollections';
+
+Ensure that only one definition for global data objects exist and change
+references to use "extern" as needed.
+
+To ensure that future changes do not introduce duplicated global
+definitions, add the -fno-common flag to XCFLAGS when using the
+configure --enable-checking setting.
+
+[cwills@sinenomine.net: Note for 1.8.x: renamed terminationEvent
+to cm_terminationEvent/fs_terminationEvent instead of deleting it.]
+
+Reviewed-on: https://gerrit.openafs.org/14106
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 0e2072ae386d4111bef161eb955964b649c31386)
+
+Change-Id: I54ca61d372cf763e4a28c0b0829ea361219f6203
+Reviewed-on: https://gerrit.openafs.org/14217
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/bucoord/main.c | 6 ++----
+ src/butc/dbentries.c | 2 +-
+ src/butc/dump.c | 7 +++----
+ src/butc/lwps.c | 2 +-
+ src/butc/tcmain.c | 2 +-
+ src/cf/osconf.m4 | 2 +-
+ src/fsprobe/fsprobe.h | 1 -
+ src/uss/uss_vol.c | 2 +-
+ src/viced/host.c | 2 ++
+ src/viced/host.h | 2 +-
+ src/vol/fssync-server.c | 3 ---
+ src/vol/volume.c | 3 ---
+ src/xstat/xstat_cm.c | 7 +++----
+ src/xstat/xstat_cm.h | 3 +--
+ src/xstat/xstat_cm_test.c | 4 ++--
+ src/xstat/xstat_fs.c | 7 +++----
+ src/xstat/xstat_fs.h | 3 +--
+ src/xstat/xstat_fs_test.c | 4 ++--
+ 18 files changed, 25 insertions(+), 37 deletions(-)
+
+diff --git a/src/bucoord/main.c b/src/bucoord/main.c
+index d2a5f368b..a453cc9dd 100644
+--- a/src/bucoord/main.c
++++ b/src/bucoord/main.c
+@@ -47,9 +47,9 @@ char tcell[64];
+ /*
+ * Global configuration information for the Backup Coordinator.
+ */
+-struct bc_config *bc_globalConfig; /*Ptr to global BC configuration info */
++extern struct bc_config *bc_globalConfig; /*Ptr to global BC configuration info */
+
+-struct ubik_client *cstruct; /* Ptr to Ubik client structure */
++extern struct ubik_client *cstruct; /* Ptr to Ubik client structure */
+ time_t tokenExpires; /* The token's expiration time */
+
+ static const char *DefaultConfDir; /*Default backup config directory */
+@@ -162,8 +162,6 @@ bc_InitTextConfig(void)
+ udbClientTextP ctPtr;
+ int i;
+
+- extern struct bc_config *bc_globalConfig;
+-
+ mkdir(DefaultConfDir, 777); /* temporary */
+
+ /* initialize the client text structures */
+diff --git a/src/butc/dbentries.c b/src/butc/dbentries.c
+index 37b35d307..29ddcbd01 100644
+--- a/src/butc/dbentries.c
++++ b/src/butc/dbentries.c
+@@ -31,7 +31,7 @@
+ #include "error_macros.h"
+
+ dlqlinkT savedEntries;
+-dlqlinkT entries_to_flush;
++static dlqlinkT entries_to_flush;
+
+ int dbWatcherinprogress;
+
+diff --git a/src/butc/dump.c b/src/butc/dump.c
+index 1f4eb9b8f..f8fc943a6 100644
+--- a/src/butc/dump.c
++++ b/src/butc/dump.c
+@@ -42,8 +42,7 @@ extern int isafile;
+ extern int forcemultiple;
+
+ extern struct ubik_client *cstruct;
+-dlqlinkT savedEntries;
+-dlqlinkT entries_to_flush;
++extern dlqlinkT savedEntries;
+
+ extern afs_int32 groupId;
+ extern afs_int32 BufferSize;
+@@ -61,8 +60,8 @@ extern char *xbsalGName;
+ extern char *globalButcLog;
+ #endif /*xbsa */
+
+-afs_int32 dataSize; /* Size of data to read on each rx_Read() call */
+-afs_int32 tapeblocks; /* Number of 16K tape datablocks in buffer (!CONF_XBSA) */
++extern afs_int32 dataSize; /* Size of data to read on each rx_Read() call */
++extern afs_int32 tapeblocks; /* Number of 16K tape datablocks in buffer (!CONF_XBSA) */
+
+ /* TBD
+ *
+diff --git a/src/butc/lwps.c b/src/butc/lwps.c
+index d262991d8..aff5e9e07 100644
+--- a/src/butc/lwps.c
++++ b/src/butc/lwps.c
+@@ -51,7 +51,7 @@ extern int forcemultiple;
+ #endif
+
+ /* XBSA Global Parameters */
+-afs_int32 xbsaType;
++extern afs_int32 xbsaType;
+ #ifdef xbsa
+ struct butx_transactionInfo butxInfo;
+ #endif
+diff --git a/src/butc/tcmain.c b/src/butc/tcmain.c
+index e8a20938e..a0298addb 100644
+--- a/src/butc/tcmain.c
++++ b/src/butc/tcmain.c
+@@ -66,7 +66,7 @@
+ #define TL_PREFIX "TL"
+ #define CFG_PREFIX "CFG"
+
+-struct ubik_client *cstruct;
++extern struct ubik_client *cstruct;
+ FILE *logIO, *ErrorlogIO, *centralLogIO, *lastLogIO;
+ char lFile[AFSDIR_PATH_MAX];
+ char logFile[AFSDIR_PATH_MAX + 256];
+diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4
+index 5f0d73fc2..e36152bd4 100644
+--- a/src/cf/osconf.m4
++++ b/src/cf/osconf.m4
+@@ -672,7 +672,7 @@ if test "x$GCC" = "xyes"; then
+ XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Wpointer-arith"
+ fi
+ if test "x$enable_checking" != "xno"; then
+- XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Werror -fdiagnostics-show-option -Wpointer-arith"
++ XCFLAGS="${XCFLAGS} -Wall -Wstrict-prototypes -Wold-style-definition -Werror -fdiagnostics-show-option -Wpointer-arith -fno-common"
+ if test "x$enable_checking" != "xall"; then
+ CFLAGS_NOERROR="-Wno-error"
+ CFLAGS_NOUNUSED="-Wno-unused"
+diff --git a/src/fsprobe/fsprobe.h b/src/fsprobe/fsprobe.h
+index 94083bfe9..3060371ae 100644
+--- a/src/fsprobe/fsprobe.h
++++ b/src/fsprobe/fsprobe.h
+@@ -103,7 +103,6 @@ struct fsprobe_ProbeResults {
+
+ extern int fsprobe_numServers; /*# servers connected */
+ extern struct fsprobe_ConnectionInfo *fsprobe_ConnInfo; /*Ptr to connections */
+-extern int numCollections; /*Num data collections */
+ extern struct fsprobe_ProbeResults fsprobe_Results; /*Latest probe results */
+
+ extern int fsprobe_Init(int, struct sockaddr_in *, int, int (*)(void), int );
+diff --git a/src/uss/uss_vol.c b/src/uss/uss_vol.c
+index c9c13941d..b31a42a06 100644
+--- a/src/uss/uss_vol.c
++++ b/src/uss/uss_vol.c
+@@ -61,7 +61,7 @@ extern int line;
+ * will work and we can avoid nasty little core dumps.
+ */
+ struct ubik_client *uconn_vldbP; /*Ubik connection struct */
+-struct ubik_client *cstruct; /*Required name for above */
++extern struct ubik_client *cstruct; /*Required name for above */
+
+ /*
+ * ------------------------ Private globals -----------------------
+diff --git a/src/viced/host.c b/src/viced/host.c
+index 36f9e88c0..e7657caac 100644
+--- a/src/viced/host.c
++++ b/src/viced/host.c
+@@ -67,6 +67,8 @@ int hostCount = 0; /* number of hosts in hostList */
+ int rxcon_ident_key;
+ int rxcon_client_key;
+
++struct host *(hosttableptrs[h_MAXHOSTTABLES]);
++
+ static struct rx_securityClass *sc = NULL;
+ static int h_quota_limit;
+
+diff --git a/src/viced/host.h b/src/viced/host.h
+index fead948f6..272dcdbe7 100644
+--- a/src/viced/host.h
++++ b/src/viced/host.h
+@@ -254,7 +254,7 @@ extern int h_RestoreState(void);
+ #define H_ENUMERATE_BAIL(flags) ((flags)|0x80000000)
+ #define H_ENUMERATE_ISSET_BAIL(flags) ((flags)&0x80000000)
+
+-struct host *(hosttableptrs[h_MAXHOSTTABLES]); /* Used by h_itoh */
++extern struct host *(hosttableptrs[h_MAXHOSTTABLES]); /* Used by h_itoh */
+ #define h_htoi(host) ((host)->index) /* index isn't zeroed, no need to lock */
+ #define h_itoh(hostindex) (hosttableptrs[(hostindex)>>h_HTSHIFT]+((hostindex)&(h_HTSPERBLOCK-1)))
+
+diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c
+index 2d7cd6011..69d902f1b 100644
+--- a/src/vol/fssync-server.c
++++ b/src/vol/fssync-server.c
+@@ -79,9 +79,6 @@
+ #endif /* USE_UNIX_SOCKETS */
+
+ #ifdef FSSYNC_BUILD_SERVER
+-
+-int (*V_BreakVolumeCallbacks) (VolumeId volume);
+-
+ #define MAXHANDLERS 4 /* Up to 4 clients; must be at least 2, so that
+ * move = dump+restore can run on single server */
+ #define MAXOFFLINEVOLUMES 128 /* This needs to be as big as the maximum
+diff --git a/src/vol/volume.c b/src/vol/volume.c
+index f1ff10a7b..3d9e47ef3 100644
+--- a/src/vol/volume.c
++++ b/src/vol/volume.c
+@@ -124,9 +124,6 @@ pthread_cond_t vol_vinit_cond;
+ int vol_attach_threads = 1;
+ #endif /* AFS_PTHREAD_ENV */
+
+-/* start-time configurable I/O parameters */
+-ih_init_params vol_io_params;
+-
+ #ifdef AFS_DEMAND_ATTACH_FS
+ pthread_mutex_t vol_salvsync_mutex;
+
+diff --git a/src/xstat/xstat_cm.c b/src/xstat/xstat_cm.c
+index d8600c124..3f5bfc843 100644
+--- a/src/xstat/xstat_cm.c
++++ b/src/xstat/xstat_cm.c
+@@ -32,9 +32,8 @@
+ int xstat_cm_numServers; /*Num connected servers */
+ struct xstat_cm_ConnectionInfo
+ *xstat_cm_ConnInfo; /*Ptr to connection array */
+-int numCollections; /*Number of data collections */
+ struct xstat_cm_ProbeResults xstat_cm_Results; /*Latest probe results */
+-char terminationEvent; /*One-shot termination event */
++char cm_terminationEvent; /*One-shot termination event */
+
+ afs_int32 xstat_cmData[AFSCB_MAX_XSTAT_LONGS]; /*Buffer for collected data */
+
+@@ -315,8 +314,8 @@ xstat_cm_LWP(void *unused)
+ */
+ if (xstat_cm_debug)
+ printf("[%s] Signalling main process at %" AFS_PTR_FMT "\n", rn,
+- &terminationEvent);
+- oneShotCode = LWP_SignalProcess(&terminationEvent);
++ &cm_terminationEvent);
++ oneShotCode = LWP_SignalProcess(&cm_terminationEvent);
+ if (oneShotCode)
+ fprintf(stderr, "[%s] Error %d from LWP_SignalProcess()", rn,
+ oneShotCode);
+diff --git a/src/xstat/xstat_cm.h b/src/xstat/xstat_cm.h
+index efbba531c..569011cc2 100644
+--- a/src/xstat/xstat_cm.h
++++ b/src/xstat/xstat_cm.h
+@@ -86,10 +86,9 @@ struct xstat_cm_ProbeResults {
+ extern int xstat_cm_numServers; /*# connected servers */
+ extern struct xstat_cm_ConnectionInfo
+ *xstat_cm_ConnInfo; /*Ptr to connections */
+-extern int numCollections; /*Num data collections */
+ extern struct xstat_cm_ProbeResults
+ xstat_cm_Results; /*Latest probe results */
+-extern char terminationEvent; /*One-shot termination event */
++extern char cm_terminationEvent; /*One-shot termination event */
+
+ /*
+ * ------------------------ Exported functions ------------------------
+diff --git a/src/xstat/xstat_cm_test.c b/src/xstat/xstat_cm_test.c
+index b284237aa..7c5e56864 100644
+--- a/src/xstat/xstat_cm_test.c
++++ b/src/xstat/xstat_cm_test.c
+@@ -881,8 +881,8 @@ RunTheTest(struct cmd_syndesc *a_s, void *arock)
+ */
+ if (debugging_on)
+ printf("[%s] Calling LWP_WaitProcess() on event %" AFS_PTR_FMT
+- "\n", rn, &terminationEvent);
+- waitCode = LWP_WaitProcess(&terminationEvent);
++ "\n", rn, &cm_terminationEvent);
++ waitCode = LWP_WaitProcess(&cm_terminationEvent);
+ if (debugging_on)
+ printf("[%s] Returned from LWP_WaitProcess()\n", rn);
+ if (waitCode) {
+diff --git a/src/xstat/xstat_fs.c b/src/xstat/xstat_fs.c
+index 51dbe3847..dff930472 100644
+--- a/src/xstat/xstat_fs.c
++++ b/src/xstat/xstat_fs.c
+@@ -33,9 +33,8 @@
+ int xstat_fs_numServers; /*Num connected servers */
+ struct xstat_fs_ConnectionInfo
+ *xstat_fs_ConnInfo; /*Ptr to connection array */
+-int numCollections; /*Number of data collections */
+ struct xstat_fs_ProbeResults xstat_fs_Results; /*Latest probe results */
+-char terminationEvent; /*One-shot termination event */
++char fs_terminationEvent; /*One-shot termination event */
+
+ afs_int32 xstat_fsData[AFS_MAX_XSTAT_LONGS]; /*Buffer for collected data */
+
+@@ -334,8 +333,8 @@ xstat_fs_LWP(void *unused)
+ */
+ if (xstat_fs_debug)
+ printf("[%s] Signalling main process at %" AFS_PTR_FMT "\n", rn,
+- &terminationEvent);
+- oneShotCode = LWP_SignalProcess(&terminationEvent);
++ &fs_terminationEvent);
++ oneShotCode = LWP_SignalProcess(&fs_terminationEvent);
+ if (oneShotCode)
+ fprintf(stderr, "[%s] Error %d from LWP_SignalProcess()", rn,
+ oneShotCode);
+diff --git a/src/xstat/xstat_fs.h b/src/xstat/xstat_fs.h
+index 6e2b77b85..a800ba679 100644
+--- a/src/xstat/xstat_fs.h
++++ b/src/xstat/xstat_fs.h
+@@ -87,10 +87,9 @@ struct xstat_fs_ProbeResults {
+ extern int xstat_fs_numServers; /*# connected servers */
+ extern struct xstat_fs_ConnectionInfo
+ *xstat_fs_ConnInfo; /*Ptr to connections */
+-extern int numCollections; /*Num data collections */
+ extern struct xstat_fs_ProbeResults
+ xstat_fs_Results; /*Latest probe results */
+-extern char terminationEvent; /*One-shot termination event */
++extern char fs_terminationEvent; /*One-shot termination event */
+
+ /*
+ * ------------------------ Exported functions ------------------------
+diff --git a/src/xstat/xstat_fs_test.c b/src/xstat/xstat_fs_test.c
+index 853c2121e..d58ecf014 100644
+--- a/src/xstat/xstat_fs_test.c
++++ b/src/xstat/xstat_fs_test.c
+@@ -778,8 +778,8 @@ RunTheTest(struct cmd_syndesc *a_s, void *dummy)
+ */
+ if (debugging_on)
+ printf("[%s] Calling LWP_WaitProcess() on event %" AFS_PTR_FMT "\n", rn,
+- &terminationEvent);
+- waitCode = LWP_WaitProcess(&terminationEvent);
++ &fs_terminationEvent);
++ waitCode = LWP_WaitProcess(&fs_terminationEvent);
+ if (debugging_on)
+ printf("[%s] Returned from LWP_WaitProcess()\n", rn);
+ if (waitCode) {
+--
+2.30.1
+
diff --git a/0001-Temporary-fix-for-compilation-with-GCC-10.patch b/0001-Temporary-fix-for-compilation-with-GCC-10.patch
deleted file mode 100644
index 9a9ce50e1cf..00000000000
--- a/0001-Temporary-fix-for-compilation-with-GCC-10.patch
+++ /dev/null
@@ -1,33 +0,0 @@
-From 81c4f50914bd0f696a0a6c356982e97594bd2c77 Mon Sep 17 00:00:00 2001
-From: =?UTF-8?q?Michael=20La=C3=9F?= <lass@mail.uni-paderborn.de>
-Date: Tue, 19 May 2020 16:17:01 +0200
-Subject: [PATCH 1/4] Temporary fix for compilation with GCC 10
-
-See:
-* https://bugs.gentoo.org/706738
-* https://gerrit.openafs.org/14106
-
-Backporting that fix to OpenAFS 1.8 requires some changes in the xstat
-code so for now let's just allow duplicate declarations.
-
-Change-Id: I0bbf317dcf584d5531db714c5e9b986f3fbb6a0b
----
- src/cf/osconf.m4 | 2 ++
- 1 file changed, 2 insertions(+)
-
-diff --git a/src/cf/osconf.m4 b/src/cf/osconf.m4
-index 5f0d73fc2..7cf761757 100644
---- a/src/cf/osconf.m4
-+++ b/src/cf/osconf.m4
-@@ -681,6 +681,8 @@ if test "x$GCC" = "xyes"; then
- else
- CFLAGS_NOSTRICT=
- fi
-+ else
-+ XCFLAGS="${XCFLAGS} -fcommon"
- fi
- else
- case $AFS_SYSNAME in
---
-2.27.0
-
diff --git a/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch b/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
index 07bd4a72b59..43d5ee53cab 100644
--- a/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
+++ b/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
@@ -1,7 +1,7 @@
-From 858ce410250bae8c5043b8277aa3941dd528d577 Mon Sep 17 00:00:00 2001
+From 509169ed302741e2499fbb116ed08408c08d3999 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 3 Jul 2020 10:33:51 -0600
-Subject: [PATCH 2/4] LINUX 5.8: Replace kernel_setsockopt with new funcs
+Subject: [PATCH 2/8] LINUX 5.8: Replace kernel_setsockopt with new funcs
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -155,5 +155,5 @@ index 9fbb563f3..50607c8f5 100644
return (osi_socket *)sockp;
}
--
-2.27.0
+2.30.1
diff --git a/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch b/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
index 9bed0a8166a..42937a90daf 100644
--- a/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
+++ b/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
@@ -1,7 +1,7 @@
-From c8d51224d54275ac34f9bb4d817842e73e777b14 Mon Sep 17 00:00:00 2001
+From 2daa3a8f5771539203d9eb8c4e23b01ed7c65a16 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 3 Jul 2020 10:34:42 -0600
-Subject: [PATCH 3/4] LINUX 5.8: do not set name field in backing_dev_info
+Subject: [PATCH 3/8] LINUX 5.8: do not set name field in backing_dev_info
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -45,5 +45,5 @@ index 8bbb5f225..ca1d5c83b 100644
#else
/* used for inodes backing_dev_info field, also */
--
-2.27.0
+2.30.1
diff --git a/0004-LINUX-5.8-use-lru_cache_add.patch b/0004-LINUX-5.8-use-lru_cache_add.patch
index b4a49c6cbb8..397c131c72e 100644
--- a/0004-LINUX-5.8-use-lru_cache_add.patch
+++ b/0004-LINUX-5.8-use-lru_cache_add.patch
@@ -1,7 +1,7 @@
-From db3408925dd69a70c14249a97d178d2762329f15 Mon Sep 17 00:00:00 2001
+From d1c503f83a2cf85c6fbf7aab24728a5f0787c54c Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Fri, 3 Jul 2020 10:35:06 -0600
-Subject: [PATCH 4/4] LINUX 5.8: use lru_cache_add
+Subject: [PATCH 4/8] LINUX 5.8: use lru_cache_add
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
@@ -104,5 +104,5 @@ index 78ff48294..11d071806 100644
dnl e.g. ip_sock_set_mtu_discover, ip_sock_set_recverr
AC_CHECK_LINUX_FUNC([ip_sock_set],
--
-2.27.0
+2.30.1
diff --git a/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch b/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
new file mode 100644
index 00000000000..e991702fef4
--- /dev/null
+++ b/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
@@ -0,0 +1,169 @@
+From c3b7278663c0e88daa611e7c1cc250e63639a496 Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Fri, 21 Aug 2020 10:37:51 -0600
+Subject: [PATCH 5/8] LINUX 5.9: Remove HAVE_UNLOCKED_IOCTL/COMPAT_IOCTL
+
+Linux-5.9-rc1 commit 'fs: remove the HAVE_UNLOCKED_IOCTL and
+HAVE_COMPAT_IOCTL defines' (4e24566a) removed the two referenced macros
+from the kernel.
+
+The support for unlocked_ioctl and compat_ioctl were introduced in
+Linux 2.6.11.
+
+Remove references to HAVE_UNLOCKED_IOCTL and HAVE_COMPAT_IOCTL using
+the assumption that they were always defined.
+
+Notes:
+
+With this change, building against kernels 2.6.10 and older will fail.
+RHEL4 (EOL in March 2017) used a 2.6.9 kernel. RHEL5 uses a 2.6.18
+kernel.
+
+In linux-2.6.33-rc1 the commit messages for "staging: comedi:
+Remove check for HAVE_UNLOCKED_IOCTL" (00a1855c) and "Staging: comedi:
+remove check for HAVE_COMPAT_IOCTL" (5d7ae225) both state that all new
+kernels have support for unlocked_ioctl/compat_ioctl so the checks can
+be removed along with removing support for older kernels.
+
+Reviewed-on: https://gerrit.openafs.org/14300
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Tested-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 13a49aaf0d5c43bce08135edaabb65587e1a8031)
+
+Change-Id: I6dc5ae5b32031641f4a021a31630390a91d834fe
+Reviewed-on: https://gerrit.openafs.org/14315
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_ioctl.c | 25 ++-----------------------
+ src/afs/LINUX/osi_vnodeops.c | 14 --------------
+ 2 files changed, 2 insertions(+), 37 deletions(-)
+
+diff --git a/src/afs/LINUX/osi_ioctl.c b/src/afs/LINUX/osi_ioctl.c
+index 1646a1518..9ba076a1b 100644
+--- a/src/afs/LINUX/osi_ioctl.c
++++ b/src/afs/LINUX/osi_ioctl.c
+@@ -25,10 +25,6 @@
+ #include <asm/ia32_unistd.h>
+ #endif
+
+-#if defined(AFS_SPARC64_LINUX26_ENV) && defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
+-#include <linux/ioctl32.h>
+-#endif
+-
+ #include <linux/slab.h>
+ #include <linux/init.h>
+ #include <linux/sched.h>
+@@ -37,9 +33,6 @@
+ #include "osi_compat.h"
+
+ extern struct proc_dir_entry *openafs_procfs;
+-#if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
+-static int ioctl32_done;
+-#endif
+
+ extern asmlinkage long
+ afs_syscall(long syscall, long parm1, long parm2, long parm3, long parm4);
+@@ -85,12 +78,11 @@ afs_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ }
+ }
+
+-#if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
+ static long afs_unlocked_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg) {
+ return afs_ioctl(FILE_INODE(file), file, cmd, arg);
+ }
+-#endif
++
+ #if defined(HAVE_LINUX_STRUCT_PROC_OPS)
+ static struct proc_ops afs_syscall_ops = {
+ .proc_ioctl = afs_unlocked_ioctl,
+@@ -100,16 +92,11 @@ static struct proc_ops afs_syscall_ops = {
+ };
+ #else
+ static struct file_operations afs_syscall_ops = {
+-# ifdef HAVE_UNLOCKED_IOCTL
+ .unlocked_ioctl = afs_unlocked_ioctl,
+-# else
+- .ioctl = afs_ioctl,
+-# endif
+-# ifdef HAVE_COMPAT_IOCTL
+ .compat_ioctl = afs_unlocked_ioctl,
+-# endif
+ };
+ #endif /* HAVE_LINUX_STRUCT_PROC_OPS */
++
+ void
+ osi_ioctl_init(void)
+ {
+@@ -121,18 +108,10 @@ osi_ioctl_init(void)
+ entry->owner = THIS_MODULE;
+ #endif
+
+-#if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
+- if (register_ioctl32_conversion(VIOC_SYSCALL32, NULL) == 0)
+- ioctl32_done = 1;
+-#endif
+ }
+
+ void
+ osi_ioctl_clean(void)
+ {
+ remove_proc_entry(PROC_SYSCALL_NAME, openafs_procfs);
+-#if defined(NEED_IOCTL32) && !defined(HAVE_COMPAT_IOCTL)
+- if (ioctl32_done)
+- unregister_ioctl32_conversion(VIOC_SYSCALL32);
+-#endif
+ }
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index 36a4f685e..ba4f1e6af 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -589,13 +589,11 @@ out1:
+ extern int afs_xioctl(struct inode *ip, struct file *fp, unsigned int com,
+ unsigned long arg);
+
+-#if defined(HAVE_UNLOCKED_IOCTL) || defined(HAVE_COMPAT_IOCTL)
+ static long afs_unlocked_xioctl(struct file *fp, unsigned int com,
+ unsigned long arg) {
+ return afs_xioctl(FILE_INODE(fp), fp, com, arg);
+
+ }
+-#endif
+
+
+ static int
+@@ -891,14 +889,8 @@ struct file_operations afs_dir_fops = {
+ #else
+ .readdir = afs_linux_readdir,
+ #endif
+-#ifdef HAVE_UNLOCKED_IOCTL
+ .unlocked_ioctl = afs_unlocked_xioctl,
+-#else
+- .ioctl = afs_xioctl,
+-#endif
+-#ifdef HAVE_COMPAT_IOCTL
+ .compat_ioctl = afs_unlocked_xioctl,
+-#endif
+ .open = afs_linux_open,
+ .release = afs_linux_release,
+ .llseek = default_llseek,
+@@ -926,14 +918,8 @@ struct file_operations afs_file_fops = {
+ .read = afs_linux_read,
+ .write = afs_linux_write,
+ #endif
+-#ifdef HAVE_UNLOCKED_IOCTL
+ .unlocked_ioctl = afs_unlocked_xioctl,
+-#else
+- .ioctl = afs_xioctl,
+-#endif
+-#ifdef HAVE_COMPAT_IOCTL
+ .compat_ioctl = afs_unlocked_xioctl,
+-#endif
+ .mmap = afs_linux_mmap,
+ .open = afs_linux_open,
+ .flush = afs_linux_flush,
+--
+2.30.1
+
diff --git a/0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch b/0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
new file mode 100644
index 00000000000..501beaf5e7c
--- /dev/null
+++ b/0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
@@ -0,0 +1,73 @@
+From 95a8c71f80e6d0aa83297fedf9f808ee01c32623 Mon Sep 17 00:00:00 2001
+From: Andrew Deason <adeason@sinenomine.net>
+Date: Thu, 28 Jan 2021 16:59:47 -0600
+Subject: [PATCH 6/8] LINUX: Fix includes for fatal_signal_pending test
+
+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+.
+
+Reviewed-on: https://gerrit.openafs.org/14508
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+(cherry picked from commit 0c1465e4f3310daa54f1e799f76237604222666d)
+
+Change-Id: I1334c060f8ab5733461ebf7c191dffa7be830021
+Reviewed-on: https://gerrit.openafs.org/14509
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_vnodeops.c | 2 ++
+ src/cf/linux-kernel-func.m4 | 7 ++++++-
+ 2 files changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index ba4f1e6af..4d0f55c95 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -1206,6 +1206,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;
+ }
+diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
+index 11d071806..e45a30540 100644
+--- a/src/cf/linux-kernel-func.m4
++++ b/src/cf/linux-kernel-func.m4
+@@ -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>],
+--
+2.30.1
+
diff --git a/0007-Linux-Refactor-test-for-32bit-compat.patch b/0007-Linux-Refactor-test-for-32bit-compat.patch
new file mode 100644
index 00000000000..89137c7c8d0
--- /dev/null
+++ b/0007-Linux-Refactor-test-for-32bit-compat.patch
@@ -0,0 +1,212 @@
+From 7efd65a984e5b50904e556992f533c460d9fcf9e Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Fri, 29 Jan 2021 11:32:36 -0700
+Subject: [PATCH 7/8] Linux: Refactor test for 32bit compat
+
+Refactor the preprocessor checks for determining the method to test for
+32bit compatibility (64bit kernel performing work for a 32bit task) into
+a common inline function, 'afs_in_compat_syscall' that is defined in
+LINUX/osi_machdep.h. Update osi_ioctl.c and afs_syscall.c to use
+afs_in_compat_syscall.
+
+Add include afs/sysincludes into osi_machdep.h to ensure linux/compat.h
+is pulled for the functions called in afs_in_compat_syscall.
+
+Reviewed-on: https://gerrit.openafs.org/14500
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 32cc6b0796495e596262d84c428172a511f757c4)
+
+Change-Id: I746e5777737d49381c4a74627b79d2a61cbd4f8e
+Reviewed-on: https://gerrit.openafs.org/14510
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_ioctl.c | 14 ++------
+ src/afs/LINUX/osi_machdep.h | 40 +++++++++++++++++++++
+ src/afs/afs_syscall.c | 70 +++----------------------------------
+ 3 files changed, 47 insertions(+), 77 deletions(-)
+
+diff --git a/src/afs/LINUX/osi_ioctl.c b/src/afs/LINUX/osi_ioctl.c
+index 9ba076a1b..7d355674d 100644
+--- a/src/afs/LINUX/osi_ioctl.c
++++ b/src/afs/LINUX/osi_ioctl.c
+@@ -43,21 +43,13 @@ afs_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+ {
+
+ struct afsprocdata sysargs;
+-#ifdef NEED_IOCTL32
+- struct afsprocdata32 sysargs32;
+-#endif
+
+ if (cmd != VIOC_SYSCALL && cmd != VIOC_SYSCALL32) return -EINVAL;
+
+ #ifdef NEED_IOCTL32
+-# if defined(AFS_S390X_LINUX26_ENV)
+- if (test_thread_flag(TIF_31BIT))
+-# elif defined(AFS_AMD64_LINUX20_ENV)
+- if (test_thread_flag(TIF_IA32))
+-# else
+- if (test_thread_flag(TIF_32BIT))
+-# endif /* AFS_S390X_LINUX26_ENV */
+- {
++ if (afs_in_compat_syscall()) {
++ struct afsprocdata32 sysargs32;
++
+ if (copy_from_user(&sysargs32, (void *)arg,
+ sizeof(struct afsprocdata32)))
+ return -EFAULT;
+diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
+index 784829627..9ecdaf0bf 100644
+--- a/src/afs/LINUX/osi_machdep.h
++++ b/src/afs/LINUX/osi_machdep.h
+@@ -76,6 +76,8 @@
+ #include "h/cred.h"
+ #endif
+
++#include "afs/sysincludes.h"
++
+ #if !defined(HAVE_LINUX_TIME_T)
+ typedef time64_t time_t;
+ #endif
+@@ -157,6 +159,44 @@ static inline long copyinstr(char *from, char *to, int count, int *length) {
+ }
+ #define copyout(F, T, C) (copy_to_user ((char*)(T), (char*)(F), (C)) > 0 ? EFAULT : 0)
+
++/*
++ * Test to see for 64/32bit compatibility mode
++ * Return non-zero if in a 64bit kernel and handing a 32bit syscall
++ */
++#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
++static inline int
++afs_in_compat_syscall(void)
++{
++# if defined(AFS_SPARC64_LINUX26_ENV)
++ return test_thread_flag(TIF_32BIT);
++# elif defined(AFS_SPARC64_LINUX24_ENV)
++ return (current->thread.flags & SPARC_FLAG_32BIT) != 0;
++# elif defined(AFS_SPARC64_LINUX20_ENV)
++ return (current->tss.flags & SPARC_FLAG_32BIT) != 0;
++# elif defined(AFS_AMD64_LINUX26_ENV)
++ return test_thread_flag(TIF_IA32);
++# elif defined(AFS_AMD64_LINUX20_ENV)
++ return (current->thread.flags & THREAD_IA32) != 0;
++# elif defined(AFS_PPC64_LINUX26_ENV)
++# if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
++ return (current->thread_info->flags & _TIF_32BIT) != 0;
++# else
++ return (task_thread_info(current)->flags & _TIF_32BIT) != 0;
++# endif
++# elif defined(AFS_PPC64_LINUX20_ENV)
++ return (current->thread.flags & PPC_FLAG_32BIT) != 0;
++# elif defined(AFS_S390X_LINUX26_ENV)
++ return test_thread_flag(TIF_31BIT);
++# elif defined(AFS_S390X_LINUX20_ENV)
++ return (current->thread.flags & S390_FLAG_31BIT) != 0;
++# elif defined(AFS_ARM64_LINUX26_ENV)
++ return is_compat_task();
++# else
++# error afs_in_compat_syscall not done for this linux
++# endif
++}
++#endif /* AFS_LINUX_64BIT_KERNEL */
++
+ /* kernel print statements */
+ #define printf(args...) printk(args)
+ #define uprintf(args...) printk(args)
+diff --git a/src/afs/afs_syscall.c b/src/afs/afs_syscall.c
+index ce6afdf9a..9414f38b8 100644
+--- a/src/afs/afs_syscall.c
++++ b/src/afs/afs_syscall.c
+@@ -114,40 +114,9 @@ copyin_afs_ioctl(caddr_t cmarg, struct afs_ioctl *dst)
+ #endif /* defined(AFS_SGI_ENV) && (_MIPS_SZLONG==64) */
+
+ #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+- struct afs_ioctl32 dst32;
+-
+-#ifdef AFS_SPARC64_LINUX26_ENV
+- if (test_thread_flag(TIF_32BIT))
+-#elif defined(AFS_SPARC64_LINUX24_ENV)
+- if (current->thread.flags & SPARC_FLAG_32BIT)
+-#elif defined(AFS_SPARC64_LINUX20_ENV)
+- if (current->tss.flags & SPARC_FLAG_32BIT)
+-
+-#elif defined(AFS_AMD64_LINUX26_ENV)
+- if (test_thread_flag(TIF_IA32))
+-#elif defined(AFS_AMD64_LINUX20_ENV)
+- if (current->thread.flags & THREAD_IA32)
+-
+-#elif defined(AFS_PPC64_LINUX26_ENV)
+-#if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
+- if (current->thread_info->flags & _TIF_32BIT)
+-#else
+- if (task_thread_info(current)->flags & _TIF_32BIT)
+-#endif
+-#elif defined(AFS_PPC64_LINUX20_ENV)
+- if (current->thread.flags & PPC_FLAG_32BIT)
+-
+-#elif defined(AFS_S390X_LINUX26_ENV)
+- if (test_thread_flag(TIF_31BIT))
+-#elif defined(AFS_S390X_LINUX20_ENV)
+- if (current->thread.flags & S390_FLAG_31BIT)
+-#elif defined(AFS_ARM64_LINUX26_ENV)
+- if (is_compat_task())
++ if (afs_in_compat_syscall()) {
++ struct afs_ioctl32 dst32;
+
+-#else
+-#error pioctl32 not done for this linux
+-#endif
+- {
+ AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code);
+ if (!code)
+ afs_ioctl32_to_afs_ioctl(&dst32, dst);
+@@ -391,40 +360,9 @@ copyin_iparam(caddr_t cmarg, struct iparam *dst)
+ #endif /* AFS_SUN5_64BIT_ENV */
+
+ #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
+- struct iparam32 dst32;
+-
+-#ifdef AFS_SPARC64_LINUX26_ENV
+- if (test_thread_flag(TIF_32BIT))
+-#elif defined(AFS_SPARC64_LINUX24_ENV)
+- if (current->thread.flags & SPARC_FLAG_32BIT)
+-#elif defined(AFS_SPARC64_LINUX20_ENV)
+- if (current->tss.flags & SPARC_FLAG_32BIT)
+-
+-#elif defined(AFS_AMD64_LINUX26_ENV)
+- if (test_thread_flag(TIF_IA32))
+-#elif defined(AFS_AMD64_LINUX20_ENV)
+- if (current->thread.flags & THREAD_IA32)
+-
+-#elif defined(AFS_PPC64_LINUX26_ENV)
+-#if defined(STRUCT_TASK_STRUCT_HAS_THREAD_INFO)
+- if (current->thread_info->flags & _TIF_32BIT)
+-#else
+- if (task_thread_info(current)->flags & _TIF_32BIT)
+-#endif
+-#elif defined(AFS_PPC64_LINUX20_ENV)
+- if (current->thread.flags & PPC_FLAG_32BIT)
+-
+-#elif defined(AFS_S390X_LINUX26_ENV)
+- if (test_thread_flag(TIF_31BIT))
+-#elif defined(AFS_S390X_LINUX20_ENV)
+- if (current->thread.flags & S390_FLAG_31BIT)
+-#elif defined(AFS_ARM64_LINUX26_ENV)
+- if (is_compat_task())
++ if (afs_in_compat_syscall()) {
++ struct iparam32 dst32;
+
+-#else
+-#error iparam32 not done for this linux platform
+-#endif
+- {
+ AFS_COPYIN(cmarg, (caddr_t) & dst32, sizeof dst32, code);
+ if (!code)
+ iparam32_to_iparam(&dst32, dst);
+--
+2.30.1
+
diff --git a/0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch b/0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch
new file mode 100644
index 00000000000..87b7285fed0
--- /dev/null
+++ b/0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch
@@ -0,0 +1,98 @@
+From 2d85a5b7a1011386d66cc36512a54e80b6cfa515 Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Fri, 22 Jan 2021 07:57:55 -0700
+Subject: [PATCH 8/8] Linux 5.11: Test 32bit compat with in_compat_syscall
+
+Linux 5.11 removed the TIF_IA32 thread flag with commit:
+ x86: Reclaim TIF_IA32 and TIF_X32 (8d71d2bf6efec)
+
+The flag TIF_IA32 was being used by openafs to determine if the task was
+handling a syscall request from a 32 bit process. Building against a
+Linux 5.11 kernel results in a build failure as TIF_IA32 is undefined.
+
+The function 'in_compat_syscall' was introduced in Linux 4.6 as
+the preferred method to determine if a syscall needed to handle a
+compatible call (e.g. 32bit application).
+
+To resolve the build problem, use 'in_compat_syscall' if present (Linux
+4.6 and later) to determine if the syscall needs to handle a
+compatibility mode call.
+
+Add autoconf check for in_compat_syscall.
+
+Notes about in_compat_syscall:
+
+In Linux 4.6 'in_compat_syscall' was defined for all architectures with
+a generic return of 'is_compat_task', but allows architecture specific
+overriding implementations (x86 and sparc).
+
+At 4.6 (and later), the function 'is_compat_task' is defined only for
+the following architectures to return:
+
+Arch Returns
+======= ==============================
+arm64 test_thread_flag(TIF_32BIT);
+mips test_thread_flag(TIF_32BIT_ADDR)
+parisc test_ti_thread_flag(task_thread_info(t), TIF_32BIT)
+powerpc is_32bit_task()
+s390 test_thread_flag(TIF_31BIT)
+sparc test_thread_flag(TIF_32BIT)
+
+If the Linux kernel is not built with compat mode, is_compat_task and
+in_compat_syscall is set to always return 0
+
+Linux commit that introduced in_compat_syscall:
+ compat: add in_compat_syscall to ask whether we're in a compat syscall
+ (5180e3e24fd3e8e7)
+
+Reviewed-on: https://gerrit.openafs.org/14499
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+(cherry picked from commit 78ef922612bef5f5fd6904896e84b9d2ea802404)
+
+Change-Id: I4eca62f19ae58fd830915feff5098cec2825f099
+Reviewed-on: https://gerrit.openafs.org/14511
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Tested-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_machdep.h | 4 +++-
+ src/cf/linux-kernel-func.m4 | 6 ++++++
+ 2 files changed, 9 insertions(+), 1 deletion(-)
+
+diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
+index 9ecdaf0bf..066c1885f 100644
+--- a/src/afs/LINUX/osi_machdep.h
++++ b/src/afs/LINUX/osi_machdep.h
+@@ -167,7 +167,9 @@ static inline long copyinstr(char *from, char *to, int count, int *length) {
+ static inline int
+ afs_in_compat_syscall(void)
+ {
+-# if defined(AFS_SPARC64_LINUX26_ENV)
++# if defined(HAVE_LINUX_IN_COMPAT_SYSCALL)
++ return in_compat_syscall();
++# elif defined(AFS_SPARC64_LINUX26_ENV)
+ return test_thread_flag(TIF_32BIT);
+ # elif defined(AFS_SPARC64_LINUX24_ENV)
+ return (current->thread.flags & SPARC_FLAG_32BIT) != 0;
+diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
+index e45a30540..5b4060238 100644
+--- a/src/cf/linux-kernel-func.m4
++++ b/src/cf/linux-kernel-func.m4
+@@ -157,6 +157,12 @@ AC_CHECK_LINUX_FUNC([lru_cache_add_file],
+ [#include <linux/swap.h>],
+ [lru_cache_add_file(NULL);])
+
++dnl Linux 4.6 introduced in_compat_syscall as replacement for is_compat_task
++dnl for certain platforms.
++AC_CHECK_LINUX_FUNC([in_compat_syscall],
++ [#include <linux/compat.h>],
++ [in_compat_syscall();])
++
+ dnl lru_cache_add exported in Linux 5.8
+ dnl replaces lru_cache_add_file
+ AC_CHECK_LINUX_FUNC([lru_cache_add],
+--
+2.30.1
+
diff --git a/PKGBUILD b/PKGBUILD
index a1c8ff1ad28..9cabea00430 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,7 +6,7 @@
pkgname=openafs-modules-dkms
_srcname=openafs
-pkgver=1.8.6
+pkgver=1.8.7
pkgrel=2
pkgdesc="Kernel module for OpenAFS (dkms)"
arch=('i686' 'x86_64' 'armv7h')
@@ -18,28 +18,44 @@ conflicts=('openafs-features-libafs' 'openafs-modules' 'openafs<1.6.6-2')
options=(!emptydirs)
source=("http://openafs.org/dl/openafs/${pkgver}/${_srcname}-${pkgver}-src.tar.bz2"
"dkms.conf"
- 0001-Temporary-fix-for-compilation-with-GCC-10.patch
+ 0001-Avoid-duplicate-definitions-of-globals.patch
0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
- 0004-LINUX-5.8-use-lru_cache_add.patch)
-sha256sums=('8b4e9d3180f1ecd752753da17ac630df04eb7007c90a921a5f6403c0339d2945'
+ 0004-LINUX-5.8-use-lru_cache_add.patch
+ 0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
+ 0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
+ 0007-Linux-Refactor-test-for-32bit-compat.patch
+ 0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch)
+sha256sums=('53543a561fce67714fec9f2a6bf408c5cc1d061c7dc9d1459458275e8ccbfa79'
'5ea5e184f9b44f5ed45817d2b5a10149d15c8c54f49e0b5b4b773652673cb9b0'
- '3d0bf6960ef1eaab87492e93ea36c3b1a6b1e12877863abd7b64ad78e4637bce'
- '5c02f2c152720bc790dfdf5f99b083b986acd34074da917efa9f39265eda7483'
- '4373b0509c1eb7f4aec4cb11a231571f1015cdf3bef6e059c0df9e493e178e83'
- '955f710fff9f535406800406bf128deccc209511b0aa9b6aacb6f3b4417a6a4d')
+ '89d423281ae4664467ff583d664cd014362f0f829f2bb1ef76809593626b55e0'
+ 'cceb2501cca12956644718c64db1c8c0e8d460afbbde302045427f0610b60a92'
+ '729f14132a917c2397f4dc713d31c74c0a278c7359c5dd4edc3758fb08e534c4'
+ '73b69cea6eef193457091090fe2c6ae090040537395618dcb47c770196bc14ef'
+ 'aef54d871c376648ef712e9cc224aa65ef012762a28778d53d509a72f99d174e'
+ '38eaec2c4e08d45b4aa130ec581ed1e265950553432d8dd878f99decc54416de'
+ 'c62380c6284f7da43234c7c2bea8503851cd455e0c06d688bbafb1d77cdbd476'
+ 'ebb0c7ddd0fde966e35c277c7474abc39772a1bbaa601e7a678c95aad31bfb48')
prepare() {
cd "${srcdir}/${_srcname}-${pkgver}"
- # Fix compilation with GCC 10 (see https://bugs.gentoo.org/706738 and https://gerrit.openafs.org/14106)
- patch -p1 < "${srcdir}"/0001-Temporary-fix-for-compilation-with-GCC-10.patch
+ # Fix compilation with GCC 10
+ patch -p1 < "${srcdir}"/0001-Avoid-duplicate-definitions-of-globals.patch
# Compatibility with Linux 5.8
patch -p1 < "${srcdir}"/0002-LINUX-5.8-Replace-kernel_setsockopt-with-new-funcs.patch
patch -p1 < "${srcdir}"/0003-LINUX-5.8-do-not-set-name-field-in-backing_dev_info.patch
patch -p1 < "${srcdir}"/0004-LINUX-5.8-use-lru_cache_add.patch
+ # Compatibility with Linux 5.9
+ patch -p1 < "${srcdir}"/0005-LINUX-5.9-Remove-HAVE_UNLOCKED_IOCTL-COMPAT_IOCTL.patch
+
+ # Compatibility with Linux 5.11
+ patch -p1 < "${srcdir}"/0006-LINUX-Fix-includes-for-fatal_signal_pending-test.patch
+ patch -p1 < "${srcdir}"/0007-Linux-Refactor-test-for-32bit-compat.patch
+ patch -p1 < "${srcdir}"/0008-Linux-5.11-Test-32bit-compat-with-in_compat_syscall.patch
+
# Only needed when changes to configure were made
./regen.sh -q
}