Commit 43cbe2cb authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

aoe: properly initialise the request_queue's backing_dev_info

AOE forgot to initialise its queue's backing_dev_info, so kernels crash.
(http://bugzilla.kernel.org/show_bug.cgi?id=9482)

Fix that and consoldate aoeblk_gdalloc()'s error handling.

Thanks be to Jon for reporting and testing.

Cc: "Ed L. Cashin" <ecashin@coraid.com>
Cc: <stable@kernel.org>
Cc: "Jon Nelson" <jnelson@jamponi.net>
Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5ea13950
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <linux/hdreg.h> #include <linux/hdreg.h>
#include <linux/blkdev.h> #include <linux/blkdev.h>
#include <linux/backing-dev.h>
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/ioctl.h> #include <linux/ioctl.h>
#include <linux/genhd.h> #include <linux/genhd.h>
...@@ -210,25 +211,20 @@ aoeblk_gdalloc(void *vp) ...@@ -210,25 +211,20 @@ aoeblk_gdalloc(void *vp)
if (gd == NULL) { if (gd == NULL) {
printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
d->aoemajor, d->aoeminor); d->aoemajor, d->aoeminor);
spin_lock_irqsave(&d->lock, flags); goto err;
d->flags &= ~DEVFL_GDALLOC;
spin_unlock_irqrestore(&d->lock, flags);
return;
} }
d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
if (d->bufpool == NULL) { if (d->bufpool == NULL) {
printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
d->aoemajor, d->aoeminor); d->aoemajor, d->aoeminor);
put_disk(gd); goto err_disk;
spin_lock_irqsave(&d->lock, flags);
d->flags &= ~DEVFL_GDALLOC;
spin_unlock_irqrestore(&d->lock, flags);
return;
} }
spin_lock_irqsave(&d->lock, flags);
blk_queue_make_request(&d->blkq, aoeblk_make_request); blk_queue_make_request(&d->blkq, aoeblk_make_request);
if (bdi_init(&d->blkq.backing_dev_info))
goto err_mempool;
spin_lock_irqsave(&d->lock, flags);
gd->major = AOE_MAJOR; gd->major = AOE_MAJOR;
gd->first_minor = d->sysminor * AOE_PARTITIONS; gd->first_minor = d->sysminor * AOE_PARTITIONS;
gd->fops = &aoe_bdops; gd->fops = &aoe_bdops;
...@@ -246,6 +242,16 @@ aoeblk_gdalloc(void *vp) ...@@ -246,6 +242,16 @@ aoeblk_gdalloc(void *vp)
add_disk(gd); add_disk(gd);
aoedisk_add_sysfs(d); aoedisk_add_sysfs(d);
return;
err_mempool:
mempool_destroy(d->bufpool);
err_disk:
put_disk(gd);
err:
spin_lock_irqsave(&d->lock, flags);
d->flags &= ~DEVFL_GDALLOC;
spin_unlock_irqrestore(&d->lock, flags);
} }
void void
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment