summarylogtreecommitdiffstats
path: root/0001-Linux-6.5-Replace-generic_file_splice_read.patch
blob: 07a96be3e9ef72662e11fc6f37dc269ba058601a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
From 04083bc9a31156e34782b689993737f7c9def427 Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Sun, 9 Jul 2023 18:52:23 -0600
Subject: [PATCH 1/4] Linux 6.5: Replace generic_file_splice_read

The Linux 6.5 commit:
    'splice: Remove generic_file_splice_read()' (c6585011bc)
replaces the function generic_file_splice_read() with the function
filemap_splice_read().

The Linux function 'filemap_splice_read()' was introduced with the
Linux 6.3 commits:

    'splice: Add a func to do a splice from a buffered file without
     ITER_PIPE' (07073eb01c)
    'splice: Export filemap/direct_splice_read()' (7c8e01ebf2)

With updates in Linux 6.5:
    'splice: Fix filemap_splice_read() to use the correct inode'
    (c37222082f) -- which fixes a problem in the code.
    'splice: Make filemap_splice_read() check s_maxbytes' (83aeff881e)

Due to the fact that there could be problems with splice support prior
to Linux 6.5 (where filemap_splice_read()'s use was expanded to
additional filesystems other than just cifs), we only want to use
'filemap_splice_read()' in Linux 6.5 and later.

The LINUX/osi_vnodeops.c file is updated to use 'filemap_splice_read()',
for Linux 6.5 and later, for the splice_read member of the
file_operations structure.

Reviewed-on: https://gerrit.openafs.org/15486
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
(cherry picked from commit 0e06eb78f293bb295b0fe12da24abd8dc1160149)

Change-Id: I3b5436234d275253a37987dc40a522ae8f3cae1e
Reviewed-on: https://gerrit.openafs.org/15520
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Mark Vitale <mvitale@sinenomine.net>
Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
(cherry picked from commit fef245769366efe8694ddadd1e1f2ed5ef8608f4)
---
 src/afs/LINUX/osi_vnodeops.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
index ccec38289..dd8b39d5d 100644
--- a/src/afs/LINUX/osi_vnodeops.c
+++ b/src/afs/LINUX/osi_vnodeops.c
@@ -960,7 +960,11 @@ struct file_operations afs_file_fops = {
 # else
   .splice_write = generic_file_splice_write,
 # endif
+# if LINUX_VERSION_CODE >= KERNEL_VERSION(6,5,0)
+  .splice_read = filemap_splice_read,
+# else
   .splice_read = generic_file_splice_read,
+# endif
 #endif
   .release =	afs_linux_release,
   .fsync =	afs_linux_fsync,
-- 
2.42.0