Skip to content

Commit f49169c

Browse files
committed
NFSD: Remove svc_serv_ops::svo_module
struct svc_serv_ops is about to be removed. Neil Brown says: > I suspect svo_module can go as well - I don't think the thread is > ever the thing that primarily keeps a module active. A random sample of kthread_create() callers shows sunrpc is the only one that manages module reference count in this way. Suggested-by: Neil Brown <[email protected]> Signed-off-by: Chuck Lever <[email protected]>
1 parent c7d7ec8 commit f49169c

File tree

7 files changed

+4
-20
lines changed

7 files changed

+4
-20
lines changed

fs/lockd/svc.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,7 @@ lockd(void *vrqstp)
184184
dprintk("lockd_down: service stopped\n");
185185

186186
svc_exit_thread(rqstp);
187-
188-
module_put_and_kthread_exit(0);
187+
return 0;
189188
}
190189

191190
static int create_lockd_listener(struct svc_serv *serv, const char *name,
@@ -352,7 +351,6 @@ static struct notifier_block lockd_inet6addr_notifier = {
352351

353352
static const struct svc_serv_ops lockd_sv_ops = {
354353
.svo_function = lockd,
355-
.svo_module = THIS_MODULE,
356354
};
357355

358356
static int lockd_get(void)

fs/nfs/callback.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#include <linux/errno.h>
1818
#include <linux/mutex.h>
1919
#include <linux/freezer.h>
20-
#include <linux/kthread.h>
2120
#include <linux/sunrpc/svcauth_gss.h>
2221
#include <linux/sunrpc/bc_xprt.h>
2322

@@ -92,8 +91,8 @@ nfs4_callback_svc(void *vrqstp)
9291
continue;
9392
svc_process(rqstp);
9493
}
94+
9595
svc_exit_thread(rqstp);
96-
module_put_and_kthread_exit(0);
9796
return 0;
9897
}
9998

@@ -136,8 +135,8 @@ nfs41_callback_svc(void *vrqstp)
136135
finish_wait(&serv->sv_cb_waitq, &wq);
137136
}
138137
}
138+
139139
svc_exit_thread(rqstp);
140-
module_put_and_kthread_exit(0);
141140
return 0;
142141
}
143142

@@ -234,12 +233,10 @@ static int nfs_callback_up_net(int minorversion, struct svc_serv *serv,
234233

235234
static const struct svc_serv_ops nfs40_cb_sv_ops = {
236235
.svo_function = nfs4_callback_svc,
237-
.svo_module = THIS_MODULE,
238236
};
239237
#if defined(CONFIG_NFS_V4_1)
240238
static const struct svc_serv_ops nfs41_cb_sv_ops = {
241239
.svo_function = nfs41_callback_svc,
242-
.svo_module = THIS_MODULE,
243240
};
244241

245242
static const struct svc_serv_ops *nfs4_cb_sv_ops[] = {

fs/nfs/nfs4state.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2697,6 +2697,5 @@ static int nfs4_run_state_manager(void *ptr)
26972697
allow_signal(SIGKILL);
26982698
nfs4_state_manager(clp);
26992699
nfs_put_client(clp);
2700-
module_put_and_kthread_exit(0);
27012700
return 0;
27022701
}

fs/nfsd/nfssvc.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,6 @@ static int nfsd_get_default_max_blksize(void)
614614

615615
static const struct svc_serv_ops nfsd_thread_sv_ops = {
616616
.svo_function = nfsd,
617-
.svo_module = THIS_MODULE,
618617
};
619618

620619
void nfsd_shutdown_threads(struct net *net)
@@ -1018,8 +1017,6 @@ nfsd(void *vrqstp)
10181017
msleep(20);
10191018
}
10201019

1021-
/* Release module */
1022-
module_put_and_kthread_exit(0);
10231020
return 0;
10241021
}
10251022

include/linux/sunrpc/svc.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,6 @@ struct svc_serv;
5757
struct svc_serv_ops {
5858
/* function for service threads to run */
5959
int (*svo_function)(void *);
60-
61-
/* optional module to count when adding threads.
62-
* Thread function must call module_put_and_kthread_exit() to exit.
63-
*/
64-
struct module *svo_module;
6560
};
6661

6762
/*

kernel/module.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ static inline void add_taint_module(struct module *mod, unsigned flag,
335335

336336
/*
337337
* A thread that wants to hold a reference to a module only while it
338-
* is running can call this to safely exit. nfsd and lockd use this.
338+
* is running can call this to safely exit.
339339
*/
340340
void __noreturn __module_put_and_kthread_exit(struct module *mod, long code)
341341
{

net/sunrpc/svc.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -736,11 +736,9 @@ svc_start_kthreads(struct svc_serv *serv, struct svc_pool *pool, int nrservs)
736736
if (IS_ERR(rqstp))
737737
return PTR_ERR(rqstp);
738738

739-
__module_get(serv->sv_ops->svo_module);
740739
task = kthread_create_on_node(serv->sv_ops->svo_function, rqstp,
741740
node, "%s", serv->sv_name);
742741
if (IS_ERR(task)) {
743-
module_put(serv->sv_ops->svo_module);
744742
svc_exit_thread(rqstp);
745743
return PTR_ERR(task);
746744
}

0 commit comments

Comments
 (0)