mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Maciej Babinski <maciej@killer-robot.net>
To: linux-kernel@vger.kernel.org
Subject: [PATCH] CIFS oops
Date: Mon, 9 Jun 2003 14:23:25 -0500	[thread overview]
Message-ID: <20030609192325.GA24583@apathy.black-flower> (raw)

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>");

                 reply	other threads:[~2003-06-09 19:09 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030609192325.GA24583@apathy.black-flower \
    --to=maciej@killer-robot.net \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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®