From: Ed L Cashin <ecashin@coraid.com>
To: linux-kernel@vger.kernel.org
Cc: Russell King <rmk+lkml@arm.linux.org.uk>,
Jens Axboe <axboe@suse.de>, Greg KH <greg@kroah.com>
Subject: [PATCH] Re: [BUG] ATA over Ethernet __init calling __exit
Date: Thu, 13 Jan 2005 12:35:05 -0500 [thread overview]
Message-ID: <871xcp9qra.fsf@coraid.com> (raw)
In-Reply-To: 20050113000949.A7449@flint.arm.linux.org.uk
[-- Attachment #1: Type: text/plain, Size: 1029 bytes --]
Russell King <rmk+lkml@arm.linux.org.uk> writes:
> static void __exit
> aoe_exit(void)
> {
> ...
> }
>
> static int __init
> aoe_init(void)
> {
> ...
> aoe_exit();
> ...
> }
Thanks for catching that. I cleaned up the error handling, too.
> In addition, please shoot the author in the other foot for:
>
> config ATA_OVER_ETH
> tristate "ATA over Ethernet support"
> depends on NET
> default m <==== this line.
>
> That's not nice for embedded guys who do a "make xxx_defconfig" and
> unsuspectingly end up with ATA over Ethernet built in for their
> platform.
OK, thanks. The patch below gets rid of that Kconfig line and
fixes the bug where __init code calls __exit code.
It depends on the recently-submitted patch that elimimates sleeping
with interrupts off, so it applies cleanly to Greg KH's usb tree.
Don't call __exit functions from __init functions.
Default to not configuring AoE support in kernel.
Signed-off-by: Ed L. Cashin <ecashin@coraid.com>
[-- Attachment #2: diff-exit-usb --]
[-- Type: text/plain, Size: 3163 bytes --]
diff -urpN usb-2.6-export-a/drivers/block/Kconfig usb-2.6-export-b/drivers/block/Kconfig
--- usb-2.6-export-a/drivers/block/Kconfig 2005-01-13 09:44:25.000000000 -0500
+++ usb-2.6-export-b/drivers/block/Kconfig 2005-01-13 12:07:56.000000000 -0500
@@ -449,7 +449,6 @@ source "drivers/block/Kconfig.iosched"
config ATA_OVER_ETH
tristate "ATA over Ethernet support"
depends on NET
- default m
help
This driver provides Support for ATA over Ethernet block
devices like the Coraid EtherDrive (R) Storage Blade.
diff -urpN usb-2.6-export-a/drivers/block/aoe/aoechr.c usb-2.6-export-b/drivers/block/aoe/aoechr.c
--- usb-2.6-export-a/drivers/block/aoe/aoechr.c 2005-01-13 09:47:33.000000000 -0500
+++ usb-2.6-export-b/drivers/block/aoe/aoechr.c 2005-01-13 10:59:23.000000000 -0500
@@ -266,7 +266,7 @@ aoechr_init(void)
return 0;
}
-void __exit
+void
aoechr_exit(void)
{
int i;
diff -urpN usb-2.6-export-a/drivers/block/aoe/aoedev.c usb-2.6-export-b/drivers/block/aoe/aoedev.c
--- usb-2.6-export-a/drivers/block/aoe/aoedev.c 2005-01-13 09:44:00.000000000 -0500
+++ usb-2.6-export-b/drivers/block/aoe/aoedev.c 2005-01-13 10:59:23.000000000 -0500
@@ -159,7 +159,7 @@ aoedev_freedev(struct aoedev *d)
kfree(d);
}
-void __exit
+void
aoedev_exit(void)
{
struct aoedev *d;
diff -urpN usb-2.6-export-a/drivers/block/aoe/aoemain.c usb-2.6-export-b/drivers/block/aoe/aoemain.c
--- usb-2.6-export-a/drivers/block/aoe/aoemain.c 2005-01-13 09:46:44.000000000 -0500
+++ usb-2.6-export-b/drivers/block/aoe/aoemain.c 2005-01-13 10:59:23.000000000 -0500
@@ -53,7 +53,7 @@ discover_timer(ulong vp)
}
}
-static void __exit
+static void
aoe_exit(void)
{
discover_timer(TKILL);
@@ -67,25 +67,43 @@ aoe_exit(void)
static int __init
aoe_init(void)
{
- int n, (**p)(void);
- int (*fns[])(void) = {
- aoedev_init, aoechr_init, aoeblk_init, aoenet_init, NULL
- };
-
- for (p=fns; *p != NULL; p++) {
- n = (*p)();
- if (n) {
- aoe_exit();
- printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
- return n;
- }
+ int ret;
+
+ ret = aoedev_init();
+ if (ret)
+ return ret;
+ ret = aoechr_init();
+ if (ret)
+ goto chr_fail;
+ ret = aoeblk_init();
+ if (ret)
+ goto blk_fail;
+ ret = aoenet_init();
+ if (ret)
+ goto net_fail;
+ ret = register_blkdev(AOE_MAJOR, DEVICE_NAME);
+ if (ret < 0) {
+ printk(KERN_ERR "aoe: aoeblk_init: can't register major\n");
+ goto blkreg_fail;
}
+
printk(KERN_INFO
"aoe: aoe_init: AoE v2.6-%s initialised.\n",
VERSION);
-
discover_timer(TINIT);
return 0;
+
+ blkreg_fail:
+ aoenet_exit();
+ net_fail:
+ aoeblk_exit();
+ blk_fail:
+ aoechr_exit();
+ chr_fail:
+ aoedev_exit();
+
+ printk(KERN_INFO "aoe: aoe_init: initialisation failure.\n");
+ return ret;
}
module_init(aoe_init);
diff -urpN usb-2.6-export-a/drivers/block/aoe/aoenet.c usb-2.6-export-b/drivers/block/aoe/aoenet.c
--- usb-2.6-export-a/drivers/block/aoe/aoenet.c 2005-01-13 09:45:02.000000000 -0500
+++ usb-2.6-export-b/drivers/block/aoe/aoenet.c 2005-01-13 10:59:23.000000000 -0500
@@ -167,7 +167,7 @@ aoenet_init(void)
return 0;
}
-void __exit
+void
aoenet_exit(void)
{
dev_remove_pack(&aoe_pt);
[-- Attachment #3: Type: text/plain, Size: 41 bytes --]
--
Ed L Cashin <ecashin@coraid.com>
prev parent reply other threads:[~2005-01-13 17:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-13 0:09 [BUG] ATA over Ethernet __init calling __exit Russell King
2005-01-13 8:50 ` Jens Axboe
2005-01-13 19:36 ` Andi Kleen
2005-01-13 20:52 ` Ed L Cashin
2005-01-13 21:53 ` Andi Kleen
2005-01-13 22:09 ` Alan Cox
2005-01-13 22:12 ` Ed L Cashin
2005-01-13 22:48 ` Andi Kleen
2005-01-13 22:59 ` Ed L Cashin
2005-01-13 17:35 ` Ed L Cashin [this message]
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=871xcp9qra.fsf@coraid.com \
--to=ecashin@coraid.com \
--cc=axboe@suse.de \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk+lkml@arm.linux.org.uk \
/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