-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
openafs-modules*: add patches for Linux 6.12
- Loading branch information
1 parent
68499de
commit 8b440be
Showing
10 changed files
with
692 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
openafs-modules-dkms/0001-Linux-Define-Clear-Set-PageError-macros-as-NOPs.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
From df2e89879bcaf45123233bc2d95acdfb6a4a5ee8 Mon Sep 17 00:00:00 2001 | ||
From: Cheyenne Wills <[email protected]> | ||
Date: Fri, 8 Nov 2024 21:32:46 -0700 | ||
Subject: [PATCH 1/3] Linux: Define Clear/Set PageError macros as NOPs | ||
|
||
The Linux 6.12 commit 'mm: remove PG_error' (09022bc196d23) removed | ||
the PG_error page flag and the associated ClearPageError() and | ||
SetPageError() functions (via removing the PAGEFLAG(Error, ...) macro). | ||
The PG_error flag has not been used by core VFS/MM Linux code for some | ||
time, possibly ever, and so our calls to these functions do not have any | ||
practical effect, since we also do not check for the PG_error flag. | ||
While we could simply remove these calls, play it safe and keep them | ||
around until ClearPageError()/SetPageError() are removed. | ||
|
||
The specific semantics of the PG_error flag are not completely well | ||
defined in the Linux kernel, which appears to be one of the motivations | ||
for its removal. Some Linux commits that mention some details on how the | ||
flag is not useful for read errors include: | ||
|
||
7edf1ec5b249 ceph: don't SetPageError on readpage errors | ||
41a638a1b3fc affs: convert affs_symlink_read_folio() to use the folio | ||
2b2553f12355 btrfs: stop setting PageError in the data I/O path | ||
|
||
Add a configure test to see if ClearPageError()/SetPageError() are | ||
available in the Linux kernel; if they are not, define | ||
ClearPageError()/SetPageError() as no-ops. | ||
|
||
Reviewed-on: https://gerrit.openafs.org/15876 | ||
Tested-by: BuildBot <[email protected]> | ||
Tested-by: Cheyenne Wills <[email protected]> | ||
Reviewed-by: Michael Meffie <[email protected]> | ||
Reviewed-by: Mark Vitale <[email protected]> | ||
Reviewed-by: Marcio Brito Barbosa <[email protected]> | ||
Reviewed-by: Andrew Deason <[email protected]> | ||
(cherry picked from commit ec146905313aaef5998b7bdfe44e86ce541a73cf) | ||
|
||
Change-Id: I2c65a2a9efe380cd2ba211ae033392fc0597b898 | ||
--- | ||
src/afs/LINUX/osi_compat.h | 13 +++++++++++++ | ||
src/afs/LINUX/osi_pagecopy.c | 4 ++++ | ||
src/cf/linux-kernel-func.m4 | 16 ++++++++++++++++ | ||
3 files changed, 33 insertions(+) | ||
|
||
diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h | ||
index 44bcb440e..e8b8f100e 100644 | ||
--- a/src/afs/LINUX/osi_compat.h | ||
+++ b/src/afs/LINUX/osi_compat.h | ||
@@ -31,6 +31,19 @@ | ||
# endif | ||
#endif | ||
|
||
+#if defined(HAVE_LINUX_NO_SETPAGEERROR) | ||
+static inline void | ||
+ClearPageError(struct page *p) | ||
+{ | ||
+ return; | ||
+} | ||
+static inline void | ||
+SetPageError(struct page *p) | ||
+{ | ||
+ return; | ||
+} | ||
+#endif | ||
+ | ||
#if !defined(HAVE_LINUX_KTHREAD_COMPLETE_AND_EXIT) | ||
# define kthread_complete_and_exit complete_and_exit | ||
#endif | ||
diff --git a/src/afs/LINUX/osi_pagecopy.c b/src/afs/LINUX/osi_pagecopy.c | ||
index 42f5e38e0..061d8c640 100644 | ||
--- a/src/afs/LINUX/osi_pagecopy.c | ||
+++ b/src/afs/LINUX/osi_pagecopy.c | ||
@@ -56,12 +56,16 @@ | ||
#include <afsconfig.h> | ||
#include "afs/param.h" | ||
|
||
+#include "afs/sysincludes.h" | ||
+#include "afsincludes.h" | ||
+ | ||
#include <linux/pagemap.h> | ||
#include <linux/kthread.h> | ||
#include <linux/wait.h> | ||
#include <linux/workqueue.h> | ||
#include <linux/slab.h> | ||
#include "osi_pagecopy.h" | ||
+#include "osi_compat.h" | ||
|
||
static DECLARE_WAIT_QUEUE_HEAD (afs_pagecopy_wq); | ||
static spinlock_t afs_pagecopy_lock; | ||
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 | ||
index 69b79c5cf..71a0c2c39 100644 | ||
--- a/src/cf/linux-kernel-func.m4 | ||
+++ b/src/cf/linux-kernel-func.m4 | ||
@@ -300,6 +300,22 @@ AC_CHECK_LINUX_FUNC([no_generic_file_splice_read], | ||
[[static char buff[10], *ap; | ||
ap = generic_file_splice_read(buff); ]]) | ||
|
||
+dnl Linux 6.12 removed the PG_error flag from the page flags along with the | ||
+dnl associated functions ClearPageError() and SetPageError(). Check to see if | ||
+dnl these functions are present in the kernel. | ||
+dnl | ||
+dnl To check if ClearPageError() and SetPageError() are missing, define our own | ||
+dnl functions with the same name but with a conflicting signature. If we can | ||
+dnl define them, the real functions must be missing. | ||
+AC_CHECK_LINUX_FUNC([no_setpageerror], | ||
+ [[#include <asm/page.h> | ||
+ #include <linux/page-flags.h> | ||
+ static inline char ClearPageError(char c) { return c;} | ||
+ static inline char SetPageError(char c) { return c;}]], | ||
+ [[static char r; | ||
+ r = ClearPageError('x'); | ||
+ r = SetPageError('x');]]) | ||
+ | ||
dnl Consequences - things which get set as a result of the | ||
dnl above tests | ||
AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"], | ||
-- | ||
2.47.0 | ||
|
96 changes: 96 additions & 0 deletions
96
openafs-modules-dkms/0002-Linux-Refactor-afs_linux_write_begin-variants.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
From f48be0e8fd2cab95c170c8d504dd688dba90ca8c Mon Sep 17 00:00:00 2001 | ||
From: Cheyenne Wills <[email protected]> | ||
Date: Thu, 7 Nov 2024 16:59:41 -0700 | ||
Subject: [PATCH 2/3] Linux: Refactor afs_linux_write_begin() variants | ||
|
||
The function afs_linux_write_begin() has 2 preprocessor selected | ||
implementations, one to handle the case where write_begin has a flag | ||
parameter and the other where it doesn't. | ||
|
||
Refactor the code to combine the 2 implementations using preprocessor | ||
conditionals for the function declaration and within the body of the | ||
function as needed. | ||
|
||
There are no functional changes. | ||
|
||
This refactoring is in preparation for additional changes that will be | ||
made to the afs_linux_write_begin() function. | ||
|
||
Reviewed-on: https://gerrit.openafs.org/15897 | ||
Tested-by: BuildBot <[email protected]> | ||
Reviewed-by: Andrew Deason <[email protected]> | ||
Reviewed-by: Michael Meffie <[email protected]> | ||
Reviewed-by: Mark Vitale <[email protected]> | ||
Reviewed-by: Marcio Brito Barbosa <[email protected]> | ||
(cherry picked from commit 2f96f95229b997a1b523f84fcb20b0d2082f0849) | ||
|
||
Change-Id: Id0a8809fcbf3d415154b607223b9480ac45cd6cd | ||
--- | ||
src/afs/LINUX/osi_vnodeops.c | 33 ++++++++------------------------- | ||
1 file changed, 8 insertions(+), 25 deletions(-) | ||
|
||
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c | ||
index f60d79a19..c7f20aae1 100644 | ||
--- a/src/afs/LINUX/osi_vnodeops.c | ||
+++ b/src/afs/LINUX/osi_vnodeops.c | ||
@@ -3618,41 +3618,25 @@ static int | ||
afs_linux_write_begin(struct file *file, struct address_space *mapping, | ||
loff_t pos, unsigned len, | ||
struct page **pagep, void **fsdata) | ||
-{ | ||
- struct page *page; | ||
- pgoff_t index = pos >> PAGE_SHIFT; | ||
- unsigned int from = pos & (PAGE_SIZE - 1); | ||
- int code; | ||
- | ||
- page = grab_cache_page_write_begin(mapping, index); | ||
- if (!page) { | ||
- return -ENOMEM; | ||
- } | ||
- | ||
- *pagep = page; | ||
- | ||
- code = afs_linux_prepare_write(file, page, from, from + len); | ||
- if (code) { | ||
- unlock_page(page); | ||
- put_page(page); | ||
- } | ||
- | ||
- return code; | ||
-} | ||
# else | ||
static int | ||
afs_linux_write_begin(struct file *file, struct address_space *mapping, | ||
- loff_t pos, unsigned len, unsigned flags, | ||
- struct page **pagep, void **fsdata) | ||
+ loff_t pos, unsigned len, unsigned flags, | ||
+ struct page **pagep, void **fsdata) | ||
+# endif | ||
{ | ||
struct page *page; | ||
pgoff_t index = pos >> PAGE_SHIFT; | ||
unsigned int from = pos & (PAGE_SIZE - 1); | ||
int code; | ||
|
||
+# if defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS) | ||
+ page = grab_cache_page_write_begin(mapping, index); | ||
+# else | ||
page = grab_cache_page_write_begin(mapping, index, flags); | ||
+# endif | ||
if (!page) { | ||
- return -ENOMEM; | ||
+ return -ENOMEM; | ||
} | ||
|
||
*pagep = page; | ||
@@ -3665,7 +3649,6 @@ afs_linux_write_begin(struct file *file, struct address_space *mapping, | ||
|
||
return code; | ||
} | ||
-# endif /* HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS */ | ||
#endif /* STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN */ | ||
|
||
#ifndef STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT | ||
-- | ||
2.47.0 | ||
|
110 changes: 110 additions & 0 deletions
110
openafs-modules-dkms/0003-Linux-Use-folios-for-aops-write_begin-end.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
From 6f1c1a5b90b1753252952d68f001b6d1a66e79eb Mon Sep 17 00:00:00 2001 | ||
From: Cheyenne Wills <[email protected]> | ||
Date: Fri, 8 Nov 2024 21:16:21 -0700 | ||
Subject: [PATCH 3/3] Linux: Use folios for aops->write_begin/end | ||
|
||
Linux-6.12 commit 'fs: Convert aops->write_begin to take a folio' | ||
(1da86618bdce3) changed the address_space_operations's members | ||
write_begin and write_end to use a folio instead of a page. | ||
|
||
Add configure check to test the signature for aop's write_begin and | ||
write_end members to see if they take a folio parameter. | ||
|
||
Update the afs_linux_write_begin and afs_linux_write_end functions to | ||
use a folio instead of a page. | ||
|
||
Reviewed-on: https://gerrit.openafs.org/15898 | ||
Tested-by: BuildBot <[email protected]> | ||
Reviewed-by: Michael Meffie <[email protected]> | ||
Reviewed-by: Mark Vitale <[email protected]> | ||
Reviewed-by: Andrew Deason <[email protected]> | ||
(cherry picked from commit 1ccc87bbdca3a616ecef9eb25b6555f5fd2b579f) | ||
|
||
Change-Id: Id0fd216e2a27ef3fe157b5d453ae21455148a1e4 | ||
--- | ||
src/afs/LINUX/osi_vnodeops.c | 25 ++++++++++++++++++++++--- | ||
src/cf/linux-kernel-func.m4 | 12 ++++++++++++ | ||
2 files changed, 34 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c | ||
index c7f20aae1..519c5da15 100644 | ||
--- a/src/afs/LINUX/osi_vnodeops.c | ||
+++ b/src/afs/LINUX/osi_vnodeops.c | ||
@@ -3598,13 +3598,23 @@ afs_linux_prepare_write(struct file *file, struct page *page, unsigned from, | ||
} | ||
|
||
#if defined(STRUCT_ADDRESS_SPACE_OPERATIONS_HAS_WRITE_BEGIN) | ||
+# if defined(HAVE_LINUX_WRITE_BEGIN_END_FOLIO) | ||
static int | ||
afs_linux_write_end(struct file *file, struct address_space *mapping, | ||
- loff_t pos, unsigned len, unsigned copied, | ||
- struct page *page, void *fsdata) | ||
+ loff_t pos, unsigned len, unsigned copied, | ||
+ struct folio *folio, void *fsdata) | ||
+# else | ||
+static int | ||
+afs_linux_write_end(struct file *file, struct address_space *mapping, | ||
+ loff_t pos, unsigned len, unsigned copied, | ||
+ struct page *page, void *fsdata) | ||
+# endif | ||
{ | ||
int code; | ||
unsigned int from = pos & (PAGE_SIZE - 1); | ||
+# if defined(HAVE_LINUX_WRITE_BEGIN_END_FOLIO) | ||
+ struct page *page = &folio->page; | ||
+# endif | ||
|
||
code = afs_linux_commit_write(file, page, from, from + copied); | ||
|
||
@@ -3613,7 +3623,12 @@ afs_linux_write_end(struct file *file, struct address_space *mapping, | ||
return code; | ||
} | ||
|
||
-# if defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS) | ||
+# if defined(HAVE_LINUX_WRITE_BEGIN_END_FOLIO) | ||
+static int | ||
+afs_linux_write_begin(struct file *file, struct address_space *mapping, | ||
+ loff_t pos, unsigned len, | ||
+ struct folio **foliop, void **fsdata) | ||
+# elif defined(HAVE_LINUX_GRAB_CACHE_PAGE_WRITE_BEGIN_NOFLAGS) | ||
static int | ||
afs_linux_write_begin(struct file *file, struct address_space *mapping, | ||
loff_t pos, unsigned len, | ||
@@ -3639,7 +3654,11 @@ afs_linux_write_begin(struct file *file, struct address_space *mapping, | ||
return -ENOMEM; | ||
} | ||
|
||
+# if defined(HAVE_LINUX_WRITE_BEGIN_END_FOLIO) | ||
+ *foliop = page_folio(page); | ||
+# else | ||
*pagep = page; | ||
+# endif | ||
|
||
code = afs_linux_prepare_write(file, page, from, from + len); | ||
if (code) { | ||
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4 | ||
index 71a0c2c39..598114671 100644 | ||
--- a/src/cf/linux-kernel-func.m4 | ||
+++ b/src/cf/linux-kernel-func.m4 | ||
@@ -316,6 +316,18 @@ AC_CHECK_LINUX_FUNC([no_setpageerror], | ||
r = ClearPageError('x'); | ||
r = SetPageError('x');]]) | ||
|
||
+dnl Linux 6.12 changed the signatgure for the address_space_operations members | ||
+dnl write_begin and write_end to use a folio instead of a page. | ||
+AC_CHECK_LINUX_FUNC([write_begin_end_folio], | ||
+ [[#include <linux/fs.h> | ||
+ static struct file *file; | ||
+ static struct address_space *mapping; | ||
+ static struct folio *foliop; | ||
+ static void *fsdata; | ||
+ static struct address_space_operations *aops;]], | ||
+ [[aops->write_begin(file, mapping, 0, 0, &foliop, fsdata); | ||
+ aops->write_end(file, mapping, 0, 0, 0, foliop, fsdata);]]) | ||
+ | ||
dnl Consequences - things which get set as a result of the | ||
dnl above tests | ||
AS_IF([test "x$ac_cv_linux_func_d_alloc_anon" = "xno"], | ||
-- | ||
2.47.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.