From 340df0b5d1e3082dcc8123ac57eb2db7b979734a Mon Sep 17 00:00:00 2001 From: Neil Brown Date: Sat, 30 Aug 2003 22:43:41 -0700 Subject: [PATCH] [PATCH] Fix module ref counting for md. We don't need to explicitly count references as: - 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. (export_array) Also, xor needs a null module_exit so that it can be unloaded. --- drivers/md/md.c | 3 +-- drivers/md/xor.c | 3 +++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/md/md.c b/drivers/md/md.c index c49e0d4216fbd..cee67e74ecbaa 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c @@ -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 --git a/drivers/md/xor.c b/drivers/md/xor.c index d625c9034a922..e2103a8bb75a0 100644 --- a/drivers/md/xor.c +++ b/drivers/md/xor.c @@ -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); -- 2.53.0