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: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by Andrew Morton and committed by Linus Torvalds 43cbe2cb 5ea13950

+16 -10
+16 -10
drivers/block/aoe/aoeblk.c
··· 6 7 #include <linux/hdreg.h> 8 #include <linux/blkdev.h> 9 #include <linux/fs.h> 10 #include <linux/ioctl.h> 11 #include <linux/genhd.h> ··· 211 if (gd == NULL) { 212 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", 213 d->aoemajor, d->aoeminor); 214 - spin_lock_irqsave(&d->lock, flags); 215 - d->flags &= ~DEVFL_GDALLOC; 216 - spin_unlock_irqrestore(&d->lock, flags); 217 - return; 218 } 219 220 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 221 if (d->bufpool == NULL) { 222 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", 223 d->aoemajor, d->aoeminor); 224 - put_disk(gd); 225 - spin_lock_irqsave(&d->lock, flags); 226 - d->flags &= ~DEVFL_GDALLOC; 227 - spin_unlock_irqrestore(&d->lock, flags); 228 - return; 229 } 230 231 - spin_lock_irqsave(&d->lock, flags); 232 blk_queue_make_request(&d->blkq, aoeblk_make_request); 233 gd->major = AOE_MAJOR; 234 gd->first_minor = d->sysminor * AOE_PARTITIONS; 235 gd->fops = &aoe_bdops; ··· 242 243 add_disk(gd); 244 aoedisk_add_sysfs(d); 245 } 246 247 void
··· 6 7 #include <linux/hdreg.h> 8 #include <linux/blkdev.h> 9 + #include <linux/backing-dev.h> 10 #include <linux/fs.h> 11 #include <linux/ioctl.h> 12 #include <linux/genhd.h> ··· 210 if (gd == NULL) { 211 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", 212 d->aoemajor, d->aoeminor); 213 + goto err; 214 } 215 216 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 217 if (d->bufpool == NULL) { 218 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", 219 d->aoemajor, d->aoeminor); 220 + goto err_disk; 221 } 222 223 blk_queue_make_request(&d->blkq, aoeblk_make_request); 224 + if (bdi_init(&d->blkq.backing_dev_info)) 225 + goto err_mempool; 226 + spin_lock_irqsave(&d->lock, flags); 227 gd->major = AOE_MAJOR; 228 gd->first_minor = d->sysminor * AOE_PARTITIONS; 229 gd->fops = &aoe_bdops; ··· 246 247 add_disk(gd); 248 aoedisk_add_sysfs(d); 249 + return; 250 + 251 + err_mempool: 252 + mempool_destroy(d->bufpool); 253 + err_disk: 254 + put_disk(gd); 255 + err: 256 + spin_lock_irqsave(&d->lock, flags); 257 + d->flags &= ~DEVFL_GDALLOC; 258 + spin_unlock_irqrestore(&d->lock, flags); 259 } 260 261 void