summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2008-12-01 07:09:35 -0500
committerSteve French <sfrench@us.ibm.com>2008-12-26 02:29:09 +0000
commit0468a2cf914e79442b8309ce62e3f861599d8cab (patch)
tree93f4055fbbe3a9c740c4c272f684b9c89dd25e11 /fs
parent80909022ce966191e6140fcc15d8aff57a7df32e (diff)
downloadlinux-0468a2cf914e79442b8309ce62e3f861599d8cab.tar.gz
linux-0468a2cf914e79442b8309ce62e3f861599d8cab.tar.bz2
linux-0468a2cf914e79442b8309ce62e3f861599d8cab.zip
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')
-rw-r--r--fs/cifs/connect.c9
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:
set_current_state(TASK_RUNNING);
}
- return 0;
+ module_put_and_exit(0);
}
/* extract the host portion of the UNC string */
@@ -2176,10 +2176,17 @@ cifs_mount(struct super_block *sb, struct cifs_sb_info *cifs_sb,
so no need to spinlock this init of tcpStatus */
srvTcp->tcpStatus = CifsNew;
init_MUTEX(&srvTcp->tcpSem);
+
+ /*
+ * since we're in a cifs function already, we know that
+ * this will succeed. No need for try_module_get().
+ */
+ __module_get(THIS_MODULE);
srvTcp->tsk = kthread_run((void *)(void *)cifs_demultiplex_thread, srvTcp, "cifsd");
if (IS_ERR(srvTcp->tsk)) {
rc = PTR_ERR(srvTcp->tsk);
cERROR(1, ("error %d create cifsd thread", rc));
+ module_put(THIS_MODULE);
srvTcp->tsk = NULL;
sock_release(csocket);
kfree(srvTcp->hostname);