2005-01-19 00:11:16

by Greg KH

[permalink] [raw]
Subject: [PATCH] AOE: fix up the block device registration so that it actually works now.

Ed, I need the following patch against the latest -bk tree in order to
get the aoe code to load and work properly. Does it look good to you?

thanks,

greg k-h

-------------

AOE: fix up the block device registration so that it actually works now.

Signed-off-by: Greg Kroah-Hartman <[email protected]>

diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
--- a/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
+++ b/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
@@ -249,6 +249,7 @@
aoeblk_exit(void)
{
kmem_cache_destroy(buf_pool_cache);
+ unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
}

int __init
diff -Nru a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
--- a/drivers/block/aoe/aoemain.c 2005-01-18 16:06:57 -08:00
+++ b/drivers/block/aoe/aoemain.c 2005-01-18 16:06:57 -08:00
@@ -82,11 +82,6 @@
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",


2005-01-19 14:12:17

by Ed L. Cashin

[permalink] [raw]
Subject: Re: [PATCH] AOE: fix up the block device registration so that it actually works now.

Greg KH <[email protected]> writes:

> Ed, I need the following patch against the latest -bk tree in order to
> get the aoe code to load and work properly. Does it look good to you?

I'm having trouble seeing what's in -bk. I have a clone of
bk://linux.bkbits.net/linux-2.5, but when I "bk pull" there it says
"Nothing to pull." And my clone doesn't have all the aoe patches I've
seen get pushed to -bk.

...
> -------------
>
> AOE: fix up the block device registration so that it actually works now.
>
> Signed-off-by: Greg Kroah-Hartman <[email protected]>
>
> diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
> --- a/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
> +++ b/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
> @@ -249,6 +249,7 @@
> aoeblk_exit(void)
> {
> kmem_cache_destroy(buf_pool_cache);
> + unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
> }

The unregister_blkdev should already be in aoemain.c:aoe_exit.

static void
aoe_exit(void)
{
discover_timer(TKILL);

aoenet_exit();
unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
aoechr_exit();
aoedev_exit();
aoeblk_exit(); /* free cache after de-allocating bufs */
}


> int __init
> diff -Nru a/drivers/block/aoe/aoemain.c b/drivers/block/aoe/aoemain.c
> --- a/drivers/block/aoe/aoemain.c 2005-01-18 16:06:57 -08:00
> +++ b/drivers/block/aoe/aoemain.c 2005-01-18 16:06:57 -08:00
> @@ -82,11 +82,6 @@
> 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",

Hmm. I'll try to send a patch against usb, since I can pull from
there.

--
Ed L Cashin <[email protected]>

2005-01-19 22:15:36

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] AOE: fix up the block device registration so that it actually works now.

On Wed, Jan 19, 2005 at 09:08:14AM -0500, Ed L Cashin wrote:
> > diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
> > --- a/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
> > +++ b/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
> > @@ -249,6 +249,7 @@
> > aoeblk_exit(void)
> > {
> > kmem_cache_destroy(buf_pool_cache);
> > + unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
> > }
>
> The unregister_blkdev should already be in aoemain.c:aoe_exit.

Why? You do a register_blockdev() in this file, so if something fails,
you should also unregister here. The big problem is you were trying to
register the same major twice :(

thanks,

greg k-h

2005-01-20 13:38:37

by Ed L. Cashin

[permalink] [raw]
Subject: Re: [PATCH] AOE: fix up the block device registration so that it actually works now.

Greg KH <[email protected]> writes:

> On Wed, Jan 19, 2005 at 09:08:14AM -0500, Ed L Cashin wrote:
>> > diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
>> > --- a/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
>> > +++ b/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
>> > @@ -249,6 +249,7 @@
>> > aoeblk_exit(void)
>> > {
>> > kmem_cache_destroy(buf_pool_cache);
>> > + unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
>> > }
>>
>> The unregister_blkdev should already be in aoemain.c:aoe_exit.
>
> Why? You do a register_blockdev() in this file, so if something fails,
> you should also unregister here.

No, the register_blkdev that you see in aoeblk.c is the artifact of a
snafu I made in patch submission. I submitted a small patch yesterday
(ID below) that corrects the snafu and makes block-2.6 the same as the
driver I have.

Message-ID: <[email protected]>

In the current aoe driver, register_blkdev is only in
aoemain.c:aoe_init, and that register_blkdev is the last step in the
initialization sequence. If register_blkdev fails, then I don't
unregister_blkdev, because presumably I shouldn't undo something that
wasn't done.

> The big problem is you were trying to
> register the same major twice :(

That's because two snippets of my recent fixes got orphaned (my fault)
instead of getting included in the submitted patches, so instead of my
patches moving register_blkdev it got duplicated. The patch I sent
yesterday corrects the problem and brings block-2.6 back into
accordance with what I've got. Sorry for the confusion.

--
Ed L Cashin <[email protected]>

2005-01-20 14:51:29

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH] AOE: fix up the block device registration so that it actually works now.

On Thu, Jan 20, 2005 at 08:35:06AM -0500, Ed L Cashin wrote:
> Greg KH <[email protected]> writes:
>
> > On Wed, Jan 19, 2005 at 09:08:14AM -0500, Ed L Cashin wrote:
> >> > diff -Nru a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
> >> > --- a/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
> >> > +++ b/drivers/block/aoe/aoeblk.c 2005-01-18 16:06:57 -08:00
> >> > @@ -249,6 +249,7 @@
> >> > aoeblk_exit(void)
> >> > {
> >> > kmem_cache_destroy(buf_pool_cache);
> >> > + unregister_blkdev(AOE_MAJOR, DEVICE_NAME);
> >> > }
> >>
> >> The unregister_blkdev should already be in aoemain.c:aoe_exit.
> >
> > Why? You do a register_blockdev() in this file, so if something fails,
> > you should also unregister here.
>
> No, the register_blkdev that you see in aoeblk.c is the artifact of a
> snafu I made in patch submission. I submitted a small patch yesterday
> (ID below) that corrects the snafu and makes block-2.6 the same as the
> driver I have.
>
> Message-ID: <[email protected]>

Ah, missed that as you didn't CC: me... I'll apply that one later on
today.

thanks,

greg k-h