summarylogtreecommitdiffstats
path: root/0004-Linux-5.17-kernel-func-complete_and_exit-renamed.patch
blob: 8abbb89b5bf0a1f616419906c10b1aa0b5760041 (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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
From a714e865efe41aa1112f6f9c8479112660dacd6f Mon Sep 17 00:00:00 2001
From: Cheyenne Wills <cwills@sinenomine.net>
Date: Thu, 27 Jan 2022 20:19:17 -0700
Subject: [PATCH 04/12] Linux-5.17: kernel func complete_and_exit renamed

Handle the Linux kernel function rename made in commit
 "exit: Rename complete_and_exit to kthread_complete_and_exit"
 (cead1855)

Add a new autoconf test for the linux function kthread_complete_and_exit
and if not found use a define to map kthread_complete_and_exit to
complete_and_exit.

Replace calls to complete_and_exit with kthread_complete_and_exit.

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

Change-Id: Ibe96b92a84a8f876dda4019c221c37dabde93244
---
 src/afs/LINUX/osi_compat.h  |  4 ++++
 src/afs/afs_call.c          | 18 ++++++++++--------
 src/cf/linux-kernel-func.m4 |  6 ++++++
 3 files changed, 20 insertions(+), 8 deletions(-)

diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
index 726b6559c..53a079b67 100644
--- a/src/afs/LINUX/osi_compat.h
+++ b/src/afs/LINUX/osi_compat.h
@@ -27,6 +27,10 @@
 # endif
 #endif
 
+#if !defined(HAVE_LINUX_KTHREAD_COMPLETE_AND_EXIT)
+# define kthread_complete_and_exit complete_and_exit
+#endif
+
 #if defined(STRUCT_DENTRY_OPERATIONS_HAS_D_AUTOMOUNT) && !defined(DCACHE_NEED_AUTOMOUNT)
 # define DCACHE_NEED_AUTOMOUNT DMANAGED_AUTOMOUNT
 #endif
diff --git a/src/afs/afs_call.c b/src/afs/afs_call.c
index 32ad210c4..fab4c01ed 100644
--- a/src/afs/afs_call.c
+++ b/src/afs/afs_call.c
@@ -19,7 +19,9 @@
 #include "afs/afs_stats.h"
 #include "rx/rx_globals.h"
 #if !defined(UKERNEL)
-# if !defined(AFS_LINUX20_ENV)
+# if defined(AFS_LINUX20_ENV)
+#  include "osi_compat.h"
+# else
 #  include "net/if.h"
 #  ifdef AFS_SGI62_ENV
 #   include "h/hashing.h"
@@ -328,7 +330,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afs_callback");
 	afs_RXCallBackServer();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_START_AFS:
 	sprintf(current->comm, "afs_afsstart");
@@ -342,7 +344,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afsd");
 	afs_Daemon();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_START_BKG:
 #ifdef AFS_NEW_BKG
@@ -361,7 +363,7 @@ afsd_thread(void *rock)
 	afs_BackgroundDaemon();
 	AFS_GUNLOCK();
 #endif
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_START_TRUNCDAEMON:
 	sprintf(current->comm, "afs_trimstart");
@@ -372,7 +374,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afs_cachetrim");
 	afs_CacheTruncateDaemon();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_START_CS:
 	sprintf(current->comm, "afs_checkserver");
@@ -380,7 +382,7 @@ afsd_thread(void *rock)
 	complete(arg->complete);
 	afs_CheckServerDaemon();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
     case AFSOP_RXEVENT_DAEMON:
 	sprintf(current->comm, "afs_evtstart");
@@ -398,7 +400,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afs_rxevent");
 	afs_rxevent_daemon();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
 #ifdef RXK_LISTENER_ENV
     case AFSOP_RXLISTENER_DAEMON:
@@ -420,7 +422,7 @@ afsd_thread(void *rock)
 	sprintf(current->comm, "afs_rxlistener");
 	rxk_Listener();
 	AFS_GUNLOCK();
-	complete_and_exit(0, 0);
+	kthread_complete_and_exit(0, 0);
 	break;
 #endif
     default:
diff --git a/src/cf/linux-kernel-func.m4 b/src/cf/linux-kernel-func.m4
index 0ca3e4463..cd4afe914 100644
--- a/src/cf/linux-kernel-func.m4
+++ b/src/cf/linux-kernel-func.m4
@@ -178,6 +178,12 @@ AC_CHECK_LINUX_FUNC([ip_sock_set],
                     [#include <net/ip.h>],
                     [ip_sock_set_mtu_discover(NULL, 0);])
 
+dnl Linux 5.17 renamed complete_and_exit to kthread_complete_and_exit
+AC_CHECK_LINUX_FUNC([kthread_complete_and_exit],
+                    [#include <linux/kernel.h>
+                     #include <linux/kthread.h>],
+                    [kthread_complete_and_exit(0, 0);])
+
 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.36.1