Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 26139
b: refs/heads/master
c: 45af7a0
h: refs/heads/master
i:
  26137: ef551ec
  26135: c582c03
v: v3
  • Loading branch information
Steve French committed Apr 21, 2006
1 parent 3e88a2f commit 11a8431
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 50 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 296034f7de8bdf111984ce1630ac598a9c94a253
refs/heads/master: 45af7a0f2ebad1304cab956e15f0b37318226fcd
99 changes: 50 additions & 49 deletions trunk/fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include <linux/vfs.h>
#include <linux/mempool.h>
#include <linux/delay.h>
#include <linux/kthread.h>
#include "cifsfs.h"
#include "cifspdu.h"
#define DECLARE_GLOBALS_HERE
Expand Down Expand Up @@ -75,9 +76,6 @@ unsigned int cifs_max_pending = CIFS_MAX_REQ;
module_param(cifs_max_pending, int, 0);
MODULE_PARM_DESC(cifs_max_pending,"Simultaneous requests to server. Default: 50 Range: 2 to 256");

static DECLARE_COMPLETION(cifs_oplock_exited);
static DECLARE_COMPLETION(cifs_dnotify_exited);

extern mempool_t *cifs_sm_req_poolp;
extern mempool_t *cifs_req_poolp;
extern mempool_t *cifs_mid_poolp;
Expand Down Expand Up @@ -841,10 +839,6 @@ static int cifs_oplock_thread(void * dummyarg)
__u16 netfid;
int rc;

daemonize("cifsoplockd");
allow_signal(SIGTERM);

oplockThread = current;
do {
if (try_to_freeze())
continue;
Expand Down Expand Up @@ -900,20 +894,16 @@ static int cifs_oplock_thread(void * dummyarg)
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(1); /* yield in case q were corrupt */
}
} while(!signal_pending(current));
oplockThread = NULL;
complete_and_exit (&cifs_oplock_exited, 0);
} while (!kthread_should_stop());

return 0;
}

static int cifs_dnotify_thread(void * dummyarg)
{
struct list_head *tmp;
struct cifsSesInfo *ses;

daemonize("cifsdnotifyd");
allow_signal(SIGTERM);

dnotifyThread = current;
do {
if(try_to_freeze())
continue;
Expand All @@ -931,8 +921,9 @@ static int cifs_dnotify_thread(void * dummyarg)
wake_up_all(&ses->server->response_q);
}
read_unlock(&GlobalSMBSeslock);
} while(!signal_pending(current));
complete_and_exit (&cifs_dnotify_exited, 0);
} while (!kthread_should_stop());

return 0;
}

static int __init
Expand Down Expand Up @@ -982,32 +973,48 @@ init_cifs(void)
}

rc = cifs_init_inodecache();
if (!rc) {
rc = cifs_init_mids();
if (!rc) {
rc = cifs_init_request_bufs();
if (!rc) {
rc = register_filesystem(&cifs_fs_type);
if (!rc) {
rc = (int)kernel_thread(cifs_oplock_thread, NULL,
CLONE_FS | CLONE_FILES | CLONE_VM);
if(rc > 0) {
rc = (int)kernel_thread(cifs_dnotify_thread, NULL,
CLONE_FS | CLONE_FILES | CLONE_VM);
if(rc > 0)
return 0;
else
cERROR(1,("error %d create dnotify thread", rc));
} else {
cERROR(1,("error %d create oplock thread",rc));
}
}
cifs_destroy_request_bufs();
}
cifs_destroy_mids();
}
cifs_destroy_inodecache();
if (rc)
goto out_clean_proc;

rc = cifs_init_mids();
if (rc)
goto out_destroy_inodecache;

rc = cifs_init_request_bufs();
if (rc)
goto out_destroy_mids;

rc = register_filesystem(&cifs_fs_type);
if (rc)
goto out_destroy_request_bufs;

oplockThread = kthread_run(cifs_oplock_thread, NULL, "cifsoplockd");
if (IS_ERR(oplockThread)) {
rc = PTR_ERR(oplockThread);
cERROR(1,("error %d create oplock thread", rc));
goto out_unregister_filesystem;
}

dnotifyThread = kthread_run(cifs_dnotify_thread, NULL, "cifsdnotifyd");
if (IS_ERR(dnotifyThread)) {
rc = PTR_ERR(dnotifyThread);
cERROR(1,("error %d create dnotify thread", rc));
goto out_stop_oplock_thread;
}

return 0;

out_stop_oplock_thread:
kthread_stop(oplockThread);
out_unregister_filesystem:
unregister_filesystem(&cifs_fs_type);
out_destroy_request_bufs:
cifs_destroy_request_bufs();
out_destroy_mids:
cifs_destroy_mids();
out_destroy_inodecache:
cifs_destroy_inodecache();
out_clean_proc:
#ifdef CONFIG_PROC_FS
cifs_proc_clean();
#endif
Expand All @@ -1025,14 +1032,8 @@ exit_cifs(void)
cifs_destroy_inodecache();
cifs_destroy_mids();
cifs_destroy_request_bufs();
if(oplockThread) {
send_sig(SIGTERM, oplockThread, 1);
wait_for_completion(&cifs_oplock_exited);
}
if(dnotifyThread) {
send_sig(SIGTERM, dnotifyThread, 1);
wait_for_completion(&cifs_dnotify_exited);
}
kthread_stop(oplockThread);
kthread_stop(dnotifyThread);
}

MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>");
Expand Down

0 comments on commit 11a8431

Please sign in to comment.