All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Linux NFS Mailing List <nfs@lists.sourceforge.net>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [PATCH] NFS/RPC modprobe -r sunrpc causes an oops
Date: Mon, 19 Jan 2004 16:21:06 -0500	[thread overview]
Message-ID: <400C4A42.5070701@RedHat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 439 bytes --]

Hello,

Here is a patch for the 2.6.1 kernel that fixes an oops
that occurs when the sunrpc module is unloaded.

The problem was the RPC cache_register() call was
not saving entry pointers to the procfs entries it was
creating. So when it came time to dismantle the
entires, a BUG_ON() was tripped in remove_proc_entry()
since the tree was not broken down completely.

Hopefully this will be a candidate for the next release.....

SteveD.

[-- Attachment #2: linux-2.6.1-nfs-cachcleanup.patch --]
[-- Type: text/plain, Size: 2095 bytes --]

--- linux-2.6.1/include/linux/sunrpc/cache.h.org	2004-01-09 01:59:42.000000000 -0500
+++ linux-2.6.1/include/linux/sunrpc/cache.h	2004-01-19 14:08:44.000000000 -0500
@@ -94,6 +94,8 @@ struct cache_detail {
 	/* fields for communication over channel */
 	struct list_head	queue;
 	struct proc_dir_entry	*proc_ent;
+	struct proc_dir_entry   *flush_ent, *channel_ent, *content_ent; 
+
 	atomic_t		readers;		/* how many time is /chennel open */
 	time_t			last_close;		/* it no readers, when did last close */
 };
--- linux-2.6.1/net/sunrpc/cache.c.org	2004-01-09 01:59:44.000000000 -0500
+++ linux-2.6.1/net/sunrpc/cache.c	2004-01-19 14:25:34.000000000 -0500
@@ -175,9 +175,11 @@ void cache_register(struct cache_detail 
 	if (cd->proc_ent) {
 		struct proc_dir_entry *p;
 		cd->proc_ent->owner = THIS_MODULE;
+		cd->channel_ent = cd->content_ent = NULL;
 		
  		p = create_proc_entry("flush", S_IFREG|S_IRUSR|S_IWUSR,
  				      cd->proc_ent);
+		cd->flush_ent =  p;
  		if (p) {
  			p->proc_fops = &cache_flush_operations;
  			p->owner = THIS_MODULE;
@@ -187,6 +189,7 @@ void cache_register(struct cache_detail 
 		if (cd->cache_request || cd->cache_parse) {
 			p = create_proc_entry("channel", S_IFREG|S_IRUSR|S_IWUSR,
 					      cd->proc_ent);
+			cd->channel_ent = p; 
 			if (p) {
 				p->proc_fops = &cache_file_operations;
 				p->owner = THIS_MODULE;
@@ -196,6 +199,7 @@ void cache_register(struct cache_detail 
  		if (cd->cache_show) {
  			p = create_proc_entry("content", S_IFREG|S_IRUSR|S_IWUSR,
  					      cd->proc_ent);
+			cd->content_ent = p; 
  			if (p) {
  				p->proc_fops = &content_file_operations;
  				p->owner = THIS_MODULE;
@@ -233,6 +237,13 @@ int cache_unregister(struct cache_detail
 	write_unlock(&cd->hash_lock);
 	spin_unlock(&cache_list_lock);
 	if (cd->proc_ent) {
+		if (cd->flush_ent) 
+			remove_proc_entry("flush", cd->proc_ent);
+		if (cd->channel_ent)
+			remove_proc_entry("channel", cd->proc_ent);
+		if (cd->content_ent)
+			remove_proc_entry("content", cd->proc_ent);
+
 		cd->proc_ent = NULL;
 		remove_proc_entry(cd->name, proc_net_rpc);
 	}

                 reply	other threads:[~2004-01-19 21:21 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=400C4A42.5070701@RedHat.com \
    --to=steved@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nfs@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.