summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Laß2023-03-01 21:34:25 +0100
committerMichael Laß2023-03-01 21:34:25 +0100
commit3dd2464cc67ffd9772c2e01f6092b48a58b69a28 (patch)
treee3378319e76c4b38c51eaddcc96597b3a6777430
parente0a91f92361e52c753327f21afe4f735c65051af (diff)
downloadaur-3dd2464cc67ffd9772c2e01f6092b48a58b69a28.tar.gz
Patch for Linux 6.2 and bugfix for Linux >= 5.13
-rw-r--r--.SRCINFO6
-rw-r--r--0001-Linux-Replace-lru_cache_add-with-folio_add_lru.patch89
-rw-r--r--0002-LINUX-5.13-set-.proc_lseek-in-proc_ops.patch45
-rw-r--r--PKGBUILD18
4 files changed, 153 insertions, 5 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 995947d5b669..61a0bf0598d6 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = openafs-modules
pkgdesc = Kernel module for OpenAFS
pkgver = 1.8.9
- pkgrel = 1
+ pkgrel = 2
url = http://www.openafs.org
install = openafs-modules.install
arch = i686
@@ -15,6 +15,10 @@ pkgbase = openafs-modules
conflicts = openafs<1.6.6-2
options = !emptydirs
source = http://openafs.org/dl/openafs/1.8.9/openafs-1.8.9-src.tar.bz2
+ source = 0001-Linux-Replace-lru_cache_add-with-folio_add_lru.patch
+ source = 0002-LINUX-5.13-set-.proc_lseek-in-proc_ops.patch
sha256sums = d126178be1f42cca18cb7c0c2691ac354518e3790170150a76bbd25f4d151f06
+ sha256sums = 18bb17dfc1cd2d2bc4db22fc0ed8676b0f2e77b1c3526ecf1341d8725c2d5e83
+ sha256sums = b1352e4efe22c92f0721e109da0c95c06cb41a574884ed97dfbf65cabb860cea
pkgname = openafs-modules
diff --git a/0001-Linux-Replace-lru_cache_add-with-folio_add_lru.patch b/0001-Linux-Replace-lru_cache_add-with-folio_add_lru.patch
new file mode 100644
index 000000000000..9138cd188d89
--- /dev/null
+++ b/0001-Linux-Replace-lru_cache_add-with-folio_add_lru.patch
@@ -0,0 +1,89 @@
+From 55ce972ab2c21115b374d56a20bf6b129635eaeb Mon Sep 17 00:00:00 2001
+From: Cheyenne Wills <cwills@sinenomine.net>
+Date: Wed, 14 Dec 2022 13:40:48 -0700
+Subject: [PATCH 1/2] Linux: Replace lru_cache_add with folio_add_lru
+
+The Linux 6.2 commit:
+ "folio-compat: remove lru_cache_add()" (6e1ca48d0)
+removed the lru_cache_add() function (which was introduced in Linux 5.8)
+
+The replacement function is folio_add_lru(), which was introduced with
+the Linux 5.16 commit:
+ "mm/lru: Add folio_add_lru()" (0d31125d2d)
+
+Reviewed-on: https://gerrit.openafs.org/15227
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+Tested-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit cfac0df9cd7152be2672c665442aac84215494d6)
+
+Change-Id: I74535bf83cdd47c9dd60a7114ec7694ae9981c9b
+Reviewed-on: https://gerrit.openafs.org/15281
+Reviewed-by: Andrew Deason <adeason@sinenomine.net>
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_vnodeops.c | 10 +++++++---
+ src/cf/linux-kernel-func.m4 | 7 +++++++
+ 2 files changed, 14 insertions(+), 3 deletions(-)
+
+diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
+index bec30bb4c..06c00ac5b 100644
+--- a/src/afs/LINUX/osi_vnodeops.c
++++ b/src/afs/LINUX/osi_vnodeops.c
+@@ -32,7 +32,7 @@
+ #endif
+ #include <linux/pagemap.h>
+ #include <linux/writeback.h>
+-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
++#if defined(HAVE_LINUX_FOLIO_ADD_LRU) || defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
+ # include <linux/swap.h>
+ #else
+ # include <linux/pagevec.h>
+@@ -78,7 +78,8 @@ extern struct vcache *afs_globalVp;
+
+ /* Handle interfacing with Linux's pagevec/lru facilities */
+
+-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) || defined(HAVE_LINUX_LRU_CACHE_ADD)
++#if defined(HAVE_LINUX_FOLIO_ADD_LRU) || \
++ defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) || defined(HAVE_LINUX_LRU_CACHE_ADD)
+
+ /*
+ * Linux's lru_cache_add_file provides a simplified LRU interface without
+@@ -97,7 +98,10 @@ afs_lru_cache_init(struct afs_lru_pages *alrupages)
+ static inline void
+ afs_lru_cache_add(struct afs_lru_pages *alrupages, struct page *page)
+ {
+-# if defined(HAVE_LINUX_LRU_CACHE_ADD)
++# if defined(HAVE_LINUX_FOLIO_ADD_LRU)
++ struct folio *folio = page_folio(page);
++ folio_add_lru(folio);
++# elif defined(HAVE_LINUX_LRU_CACHE_ADD)
+ lru_cache_add(page);
+ # elif defined(HAVE_LINUX_LRU_CACHE_ADD_FILE)
+ lru_cache_add_file(page);
+diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
+index d3abdf9ff..09cf10f4c 100644
+--- a/src/cf/linux-kernel-func.m4
++++ b/src/cf/linux-kernel-func.m4
+@@ -173,10 +173,17 @@ AC_CHECK_LINUX_FUNC([in_compat_syscall],
+
+ dnl lru_cache_add exported in Linux 5.8
+ dnl replaces lru_cache_add_file
++dnl removed in linux 6.1. folio_add_lru is a replacement
+ AC_CHECK_LINUX_FUNC([lru_cache_add],
+ [#include <linux/swap.h>],
+ [lru_cache_add(NULL);])
+
++dnl Linux 5.16 added folio_add_lru as a replacement for
++dnl lru_cache_add
++AC_CHECK_LINUX_FUNC([folio_add_lru],
++ [#include <linux/swap.h>],
++ [folio_add_lru(NULL);])
++
+ dnl Linux 5.8 replaced kernel_setsockopt with helper functions
+ dnl e.g. ip_sock_set_mtu_discover, ip_sock_set_recverr
+ AC_CHECK_LINUX_FUNC([ip_sock_set],
+--
+2.39.2
+
diff --git a/0002-LINUX-5.13-set-.proc_lseek-in-proc_ops.patch b/0002-LINUX-5.13-set-.proc_lseek-in-proc_ops.patch
new file mode 100644
index 000000000000..98b998778b7d
--- /dev/null
+++ b/0002-LINUX-5.13-set-.proc_lseek-in-proc_ops.patch
@@ -0,0 +1,45 @@
+From 9251a7010b77e2702d22addfe57e83d644339786 Mon Sep 17 00:00:00 2001
+From: Jeffrey Hutzelman <jhutz@cmu.edu>
+Date: Tue, 1 Mar 2022 10:31:14 -0500
+Subject: [PATCH 2/2] LINUX 5.13: set .proc_lseek in proc_ops
+
+When using the proc_ops structure, set .proc_lseek explicitly rather
+than leaving it unset. This field has always been present in proc_ops,
+but prior to Linux 5.13, it could be unset, causing default_llseek to be
+used. Starting with commit d4455faccd6 (proc: mandate ->proc_lseek in
+"struct proc_ops"), this field is now mandatory.
+
+This fixes a problem which would cause an oops if llseek(2) is called
+on /proc/fs/openafs/afs_ioctl.
+
+Reviewed-on: https://gerrit.openafs.org/14918
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Cheyenne Wills <cwills@sinenomine.net>
+Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
+Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
+(cherry picked from commit 68851b782ca2cb5e4ae7457255841f44f3bef15c)
+
+Change-Id: Ifd3a517f595cfef7fd9dd1fdd3f3aca8fe1bc25f
+Reviewed-on: https://gerrit.openafs.org/15286
+Tested-by: BuildBot <buildbot@rampaginggeek.com>
+Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
+Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
+---
+ src/afs/LINUX/osi_ioctl.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/src/afs/LINUX/osi_ioctl.c b/src/afs/LINUX/osi_ioctl.c
+index 327520c02..fbdee29cb 100644
+--- a/src/afs/LINUX/osi_ioctl.c
++++ b/src/afs/LINUX/osi_ioctl.c
+@@ -81,6 +81,7 @@ static struct proc_ops afs_syscall_ops = {
+ # ifdef STRUCT_PROC_OPS_HAS_PROC_COMPAT_IOCTL
+ .proc_compat_ioctl = afs_unlocked_ioctl,
+ # endif
++ .proc_lseek = default_llseek,
+ };
+ #else
+ static struct file_operations afs_syscall_ops = {
+--
+2.39.2
+
diff --git a/PKGBUILD b/PKGBUILD
index 909532a6e057..be10df0a85d8 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -6,7 +6,7 @@
pkgname=openafs-modules
_srcname=openafs
pkgver=1.8.9
-pkgrel=1
+pkgrel=2
pkgdesc="Kernel module for OpenAFS"
arch=('i686' 'x86_64' 'armv7h')
url="http://www.openafs.org"
@@ -16,8 +16,12 @@ makedepends=('libelf' 'linux-headers')
conflicts=('openafs-features-libafs' 'openafs<1.6.6-2')
options=(!emptydirs)
install=openafs-modules.install
-source=(http://openafs.org/dl/openafs/${pkgver}/${_srcname}-${pkgver}-src.tar.bz2)
-sha256sums=('d126178be1f42cca18cb7c0c2691ac354518e3790170150a76bbd25f4d151f06')
+source=(http://openafs.org/dl/openafs/${pkgver}/${_srcname}-${pkgver}-src.tar.bz2
+ 0001-Linux-Replace-lru_cache_add-with-folio_add_lru.patch
+ 0002-LINUX-5.13-set-.proc_lseek-in-proc_ops.patch)
+sha256sums=('d126178be1f42cca18cb7c0c2691ac354518e3790170150a76bbd25f4d151f06'
+ '18bb17dfc1cd2d2bc4db22fc0ed8676b0f2e77b1c3526ecf1341d8725c2d5e83'
+ 'b1352e4efe22c92f0721e109da0c95c06cb41a574884ed97dfbf65cabb860cea')
# Heuristic to determine version of installed kernel
# You can modify this if the heuristic fails
@@ -32,8 +36,14 @@ _extramodules="/usr/lib/modules/${_kernelver}/extramodules"
prepare() {
cd "${srcdir}/${_srcname}-${pkgver}"
+ # https://gerrit.openafs.org/#/c/15281/
+ patch -p1 < "${srcdir}"/0001-Linux-Replace-lru_cache_add-with-folio_add_lru.patch
+
+ # https://gerrit.openafs.org/#/c/15286/
+ patch -p1 < "${srcdir}"/0002-LINUX-5.13-set-.proc_lseek-in-proc_ops.patch
+
# Only needed when changes to configure were made
- #./regen.sh -q
+ ./regen.sh -q
}
build() {