diff options
author | Jeff Layton <jlayton@redhat.com> | 2008-12-01 07:09:35 -0500 |
---|---|---|
committer | Steve French <sfrench@us.ibm.com> | 2008-12-25 21:29:09 -0500 |
commit | 0468a2cf914e79442b8309ce62e3f861599d8cab (patch) | |
tree | 93f4055fbbe3a9c740c4c272f684b9c89dd25e11 /fs/cifs/connect.c | |
parent | 80909022ce966191e6140fcc15d8aff57a7df32e (diff) |
cifs: take module reference when starting cifsd
cifsd can outlive the last cifs mount. We need to hold a module
reference until it exits to prevent someone from unplugging
the module until we're ready.
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/cifs/connect.c')
-rw-r--r-- | fs/cifs/connect.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c index c7d341714586..701daf411a4b 100644 --- a/fs/cifs/connect.c +++ b/fs/cifs/connect.c | |||
@@ -776,7 +776,7 @@ multi_t2_fnd: | |||
776 | set_current_state(TASK_RUNNING); | 776 | set_current_state(TASK_RUNNING); |
777 | } | 777 | } |
778 | 778 | ||
779 | return 0; | 779 | module_put_and_exit(0); |
780 | } | 780 | } |
781 | 781 | ||
782 | /* extract the host portion of the UNC string */ | 782 | /* extract the host portion of the UNC string */ |
@@ -2176,10 +2176,17 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb, | |||
2176 | so no need to spinlock this init of tcpStatus */ | 2176 | so no need to spinlock this init of tcpStatus */ |
2177 | srvTcp->tcpStatus = CifsNew; | 2177 | srvTcp->tcpStatus = CifsNew; |
2178 | init_MUTEX(&srvTcp->tcpSem); | 2178 | init_MUTEX(&srvTcp->tcpSem); |
2179 | |||
2180 | /* | ||
2181 | * since we're in a cifs function already, we know that | ||
2182 | * this will succeed. No need for try_module_get(). | ||
2183 | */ | ||
2184 | __module_get(THIS_MODULE); | ||
2179 | srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd"); | 2185 | srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd"); |
2180 | if (IS_ERR(srvTcp->tsk)) { | 2186 | if (IS_ERR(srvTcp->tsk)) { |
2181 | rc = PTR_ERR(srvTcp->tsk); | 2187 | rc = PTR_ERR(srvTcp->tsk); |
2182 | cERROR(1, ("error %d create cifsd thread", rc)); | 2188 | cERROR(1, ("error %d create cifsd thread", rc)); |
2189 | module_put(THIS_MODULE); | ||
2183 | srvTcp->tsk = NULL; | 2190 | srvTcp->tsk = NULL; |
2184 | sock_release(csocket); | 2191 | sock_release(csocket); |
2185 | kfree(srvTcp->hostname); | 2192 | kfree(srvTcp->hostname); |