Commit a6af37ef authored by Steve French's avatar Steve French

Fix oops on stopping cifs oplock thread when removing cifs module

parent c42cfca4
Version 0.80
-----------
Fix oops on stopping oplock thread when removing cifs when
built as module.
Version 0.79 Version 0.79
------------ ------------
Fix mount options for ro (readonly), uid, gid and file and directory mode. Fix mount options for ro (readonly), uid, gid and file and directory mode.
......
...@@ -62,6 +62,9 @@ extern int cifs_umount(struct super_block *, struct cifs_sb_info *); ...@@ -62,6 +62,9 @@ extern int cifs_umount(struct super_block *, struct cifs_sb_info *);
void cifs_proc_init(void); void cifs_proc_init(void);
void cifs_proc_clean(void); void cifs_proc_clean(void);
static DECLARE_COMPLETION(cifs_oplock_exited);
static int static int
cifs_read_super(struct super_block *sb, void *data, cifs_read_super(struct super_block *sb, void *data,
const char *devname, int silent) const char *devname, int silent)
...@@ -427,7 +430,8 @@ cifs_destroy_mids(void) ...@@ -427,7 +430,8 @@ cifs_destroy_mids(void)
"cifs_destroy_mids: error not all structures were freed\n"); "cifs_destroy_mids: error not all structures were freed\n");
if (kmem_cache_destroy(cifs_oplock_cachep)) if (kmem_cache_destroy(cifs_oplock_cachep))
printk(KERN_WARNING 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) static int cifs_oplock_thread(void * dummyarg)
{ {
...@@ -439,14 +443,13 @@ static int cifs_oplock_thread(void * dummyarg) ...@@ -439,14 +443,13 @@ static int cifs_oplock_thread(void * dummyarg)
int rc; int rc;
daemonize("cifsoplockd"); daemonize("cifsoplockd");
allow_signal(SIGKILL); allow_signal(SIGTERM);
oplockThread = current; oplockThread = current;
while (1) { do {
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
schedule_timeout(100*HZ); schedule_timeout(100*HZ);
/* BB add missing code */ /* BB add missing code */
cFYI(1,("oplock thread woken up - flush inode")); /* BB remove */
write_lock(&GlobalMid_Lock); write_lock(&GlobalMid_Lock);
list_for_each_safe(tmp, tmp1, &GlobalOplock_Q) { list_for_each_safe(tmp, tmp1, &GlobalOplock_Q) {
oplock_item = list_entry(tmp, struct oplock_q_entry, oplock_item = list_entry(tmp, struct oplock_q_entry,
...@@ -466,11 +469,10 @@ static int cifs_oplock_thread(void * dummyarg) ...@@ -466,11 +469,10 @@ static int cifs_oplock_thread(void * dummyarg)
write_lock(&GlobalMid_Lock); write_lock(&GlobalMid_Lock);
} else } else
break; break;
cFYI(1,("next time through list")); /* BB remove */
} }
write_unlock(&GlobalMid_Lock); write_unlock(&GlobalMid_Lock);
cFYI(1,("next time through while loop")); /* BB remove */ } while(!signal_pending(current));
} complete_and_exit (&cifs_oplock_exited, 0);
} }
static int __init static int __init
...@@ -532,8 +534,10 @@ exit_cifs(void) ...@@ -532,8 +534,10 @@ exit_cifs(void)
cifs_destroy_inodecache(); cifs_destroy_inodecache();
cifs_destroy_mids(); cifs_destroy_mids();
cifs_destroy_request_bufs(); cifs_destroy_request_bufs();
if(oplockThread) if(oplockThread) {
send_sig(SIGKILL, oplockThread, 1); send_sig(SIGTERM, oplockThread, 1);
wait_for_completion(&cifs_oplock_exited);
}
} }
MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>"); MODULE_AUTHOR("Steve French <sfrench@us.ibm.com>");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment