diff --git a/b885159.diff b/b885159.diff new file mode 100644 index 0000000..9df8d37 --- /dev/null +++ b/b885159.diff @@ -0,0 +1,83 @@ +From b885159cc2bc6c746aec1d54cdd8a515d1115d14 Mon Sep 17 00:00:00 2001 +From: Cheyenne Wills +Date: Wed, 14 Dec 2022 13:40:48 -0700 +Subject: [PATCH] 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 +Tested-by: Benjamin Kaduk +(cherry picked from commit cfac0df9cd7152be2672c665442aac84215494d6) + +Change-Id: I74535bf83cdd47c9dd60a7114ec7694ae9981c9b +Reviewed-on: https://gerrit.openafs.org/15281 +Reviewed-by: Andrew Deason +Tested-by: BuildBot +Reviewed-by: Michael Meffie +Reviewed-by: Stephan Wiesand +--- + +diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c +index 5ff3a16..d875788 100644 +--- a/src/afs/LINUX/osi_vnodeops.c ++++ b/src/afs/LINUX/osi_vnodeops.c +@@ -32,7 +32,7 @@ + #endif + #include + #include +-#if defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) ++#if defined(HAVE_LINUX_FOLIO_ADD_LRU) || defined(HAVE_LINUX_LRU_CACHE_ADD_FILE) + # include + #else + # include +@@ -78,7 +78,8 @@ + + /* 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 @@ + 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 504c731..a53c186 100644 +--- a/src/cf/linux-kernel-func.m4 ++++ b/src/cf/linux-kernel-func.m4 +@@ -173,10 +173,17 @@ + + 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 ], + [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 ], ++ [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], diff --git a/openafs.changes b/openafs.changes index 7328274..d923f2d 100644 --- a/openafs.changes +++ b/openafs.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Mar 2 14:01:53 UTC 2023 - Christof Hanke + +- apply patch from upstream for kernel 6.2: + * b885159.diff +- change BuildArch for subpackage kernel-source to noarch + ------------------------------------------------------------------- Wed Jan 4 08:14:39 UTC 2023 - Christof Hanke diff --git a/openafs.spec b/openafs.spec index f3ab796..c31cd28 100644 --- a/openafs.spec +++ b/openafs.spec @@ -103,6 +103,8 @@ Source58: openafs.cacheinfo Source98: kmp_only.files Source99: openafs.changes +# PATCH-FIX-UPSTREAM fix build with kernel 6.2 +Patch1: b885159.diff # PATCH-FIX-UPSTREAM make configure detect ncurses 6 correctly Patch4: 4cf7a9a.diff @@ -215,6 +217,7 @@ caching, disconnected operations, replication for higher availability and load balancing, and ACLs. This package contains the OpenAFS server. %package kernel-source +BuildArch: noarch Summary: OpenAFS Kernel Module source tree Group: System/Filesystems Requires: bison @@ -314,6 +317,7 @@ for src_file in %{S:0} %{S:1}; do done %setup -q -n openafs-%{upstream_version} -T -b 0 -b 1 +%patch1 -p1 %patch4 -p1 ./regen.sh