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 6 7 7 #include <linux/hdreg.h> 8 8 #include <linux/blkdev.h> 9 + #include <linux/backing-dev.h> 9 10 #include <linux/fs.h> 10 11 #include <linux/ioctl.h> 11 12 #include <linux/genhd.h> ··· 211 210 if (gd == NULL) { 212 211 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", 213 212 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; 213 + goto err; 218 214 } 219 215 220 216 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 221 217 if (d->bufpool == NULL) { 222 218 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", 223 219 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; 220 + goto err_disk; 229 221 } 230 222 231 - spin_lock_irqsave(&d->lock, flags); 232 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); 233 227 gd->major = AOE_MAJOR; 234 228 gd->first_minor = d->sysminor * AOE_PARTITIONS; 235 229 gd->fops = &aoe_bdops; ··· 242 246 243 247 add_disk(gd); 244 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); 245 259 } 246 260 247 261 void