* [PATCH] CIFS oops
@ 2003-06-09 19:23 Maciej Babinski
0 siblings, 0 replies; only message in thread
From: Maciej Babinski @ 2003-06-09 19:23 UTC (permalink / raw)
To: linux-kernel
This patch fixes a non-critical oops that occurs when the cifs module is
removed from the kernel. It uses the completion.h mechanism to
ensure that the cifsoplockd kernel thread exits before the module is
unloaded.
-- Maciej Babinski
--- linux-2.5.70.old/fs/cifs/cifsfs.c Mon May 26 20:00:40 2003
+++ linux-2.5.70/fs/cifs/cifsfs.c Mon Jun 9 12:59:31 2003
@@ -62,6 +62,8 @@
void cifs_proc_init(void);
void cifs_proc_clean(void);
+static DECLARE_COMPLETION(cifsoplock_exited);
+
static int
cifs_read_super(struct super_block *sb, void *data,
const char *devname, int silent)
@@ -423,7 +425,8 @@
"cifs_destroy_mids: error not all structures were freed\n");
if (kmem_cache_destroy(cifs_oplock_cachep))
printk(KERN_WARNING
- "error not all oplock structures were freed\n");}
+ "error not all oplock structures were freed\n");
+}
static int cifs_oplock_thread(void * dummyarg)
{
@@ -435,10 +438,10 @@
int rc;
daemonize("cifsoplockd");
- allow_signal(SIGKILL);
+ allow_signal(SIGTERM);
oplockThread = current;
- while (1) {
+ do {
set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(100*HZ);
/* BB add missing code */
@@ -466,7 +469,9 @@
}
write_unlock(&GlobalMid_Lock);
cFYI(1,("next time through while loop")); /* BB remove */
- }
+ } while (!signal_pending(current));
+
+ complete_and_exit (&cifsoplock_exited, 0);
}
static int __init
@@ -528,8 +533,10 @@
cifs_destroy_inodecache();
cifs_destroy_mids();
cifs_destroy_request_bufs();
- if(oplockThread)
- send_sig(SIGKILL, oplockThread, 1);
+ if(oplockThread) {
+ send_sig(SIGTERM, oplockThread, 1);
+ wait_for_completion(&cifsoplock_exited);
+ }
}
MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2003-06-09 19:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-06-09 19:23 [PATCH] CIFS oops Maciej Babinski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®