linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: NeilBrown <neilb@cse.unsw.edu.au>
To: Linus Torvalds <torvalds@osdl.org>
Cc: linux-raid@vger.kernel.org
Subject: [PATCH] md - 2 of 2 - Fix module ref counting for md.
Date: Fri, 15 Aug 2003 11:41:15 +1000	[thread overview]
Message-ID: <E19nTad-0002sf-00@notabene> (raw)

### Comments for ChangeSet

We don't need to explicit count references say:
 refcounting already happens for opens of /dev/md?
 when an array is active, a daughter module is loaded which
   locks "md" in.
We just need to make sure we clean up properly on unload.

Also, xor needs a null module_exit so that it can be unloaded.

 ----------- Diffstat output ------------
 ./drivers/md/md.c  |    3 +--
 ./drivers/md/xor.c |    3 +++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff ./drivers/md/md.c~current~ ./drivers/md/md.c
--- ./drivers/md/md.c~current~	2003-08-15 11:34:14.000000000 +1000
+++ ./drivers/md/md.c	2003-08-15 11:34:14.000000000 +1000
@@ -179,7 +179,6 @@ static void mddev_put(mddev_t *mddev)
 		mddev_map[mdidx(mddev)] = NULL;
 		blk_put_queue(mddev->queue);
 		kfree(mddev);
-		MOD_DEC_USE_COUNT;
 	}
 	spin_unlock(&all_mddevs_lock);
 }
@@ -201,7 +200,6 @@ static mddev_t * mddev_find(int unit)
 		mddev_map[unit] = new;
 		list_add(&new->all_mddevs, &all_mddevs);
 		spin_unlock(&all_mddevs_lock);
-		MOD_INC_USE_COUNT;
 		return new;
 	}
 	spin_unlock(&all_mddevs_lock);
@@ -3590,6 +3588,7 @@ static __exit void md_exit(void)
 		if (!disks[i])
 			continue;
 		mddev = disk->private_data;
+		export_array(mddev);
 		del_gendisk(disk);
 		put_disk(disk);
 		mddev_put(mddev);

diff ./drivers/md/xor.c~current~ ./drivers/md/xor.c
--- ./drivers/md/xor.c~current~	2003-08-15 11:34:14.000000000 +1000
+++ ./drivers/md/xor.c	2003-08-15 11:34:14.000000000 +1000
@@ -134,7 +134,10 @@ calibrate_xor_block(void)
 	return 0;
 }
 
+static __exit void xor_exit(void) { }
+
 EXPORT_SYMBOL(xor_block);
 MODULE_LICENSE("GPL");
 
 module_init(calibrate_xor_block);
+module_exit(xor_exit);

                 reply	other threads:[~2003-08-15  1:41 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=E19nTad-0002sf-00@notabene \
    --to=neilb@cse.unsw.edu.au \
    --cc=linux-raid@vger.kernel.org \
    --cc=torvalds@osdl.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;
as well as URLs for NNTP newsgroup(s).