aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe/aoeblk.c
diff options
context:
space:
mode:
authorAndrew Morton <akpm@linux-foundation.org>2007-12-10 18:49:13 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-12-10 22:43:54 -0500
commit43cbe2cbdd5320f1ac785c6f016923609831effe (patch)
tree4ae26f9c44362f29edc390eb469e110796d970ee /drivers/block/aoe/aoeblk.c
parent5ea139503bc7907ca0772c25bbcfb7fbb8ffc16b (diff)
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>
Diffstat (limited to 'drivers/block/aoe/aoeblk.c')
-rw-r--r--drivers/block/aoe/aoeblk.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/drivers/block/aoe/aoeblk.c b/drivers/block/aoe/aoeblk.c
index b1d00ef6659c..ad00b3d94711 100644
--- a/drivers/block/aoe/aoeblk.c
+++ b/drivers/block/aoe/aoeblk.c
@@ -6,6 +6,7 @@
6 6
7#include <linux/hdreg.h> 7#include <linux/hdreg.h>
8#include <linux/blkdev.h> 8#include <linux/blkdev.h>
9#include <linux/backing-dev.h>
9#include <linux/fs.h> 10#include <linux/fs.h>
10#include <linux/ioctl.h> 11#include <linux/ioctl.h>
11#include <linux/genhd.h> 12#include <linux/genhd.h>
@@ -210,25 +211,20 @@ aoeblk_gdalloc(void *vp)
210 if (gd == NULL) { 211 if (gd == NULL) {
211 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n", 212 printk(KERN_ERR "aoe: cannot allocate disk structure for %ld.%ld\n",
212 d->aoemajor, d->aoeminor); 213 d->aoemajor, d->aoeminor);
213 spin_lock_irqsave(&d->lock, flags); 214 goto err;
214 d->flags &= ~DEVFL_GDALLOC;
215 spin_unlock_irqrestore(&d->lock, flags);
216 return;
217 } 215 }
218 216
219 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache); 217 d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
220 if (d->bufpool == NULL) { 218 if (d->bufpool == NULL) {
221 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n", 219 printk(KERN_ERR "aoe: cannot allocate bufpool for %ld.%ld\n",
222 d->aoemajor, d->aoeminor); 220 d->aoemajor, d->aoeminor);
223 put_disk(gd); 221 goto err_disk;
224 spin_lock_irqsave(&d->lock, flags);
225 d->flags &= ~DEVFL_GDALLOC;
226 spin_unlock_irqrestore(&d->lock, flags);
227 return;
228 } 222 }
229 223
230 spin_lock_irqsave(&d->lock, flags);
231 blk_queue_make_request(&d->blkq, aoeblk_make_request); 224 blk_queue_make_request(&d->blkq, aoeblk_make_request);
225 if (bdi_init(&d->blkq.backing_dev_info))
226 goto err_mempool;
227 spin_lock_irqsave(&d->lock, flags);
232 gd->major = AOE_MAJOR; 228 gd->major = AOE_MAJOR;
233 gd->first_minor = d->sysminor * AOE_PARTITIONS; 229 gd->first_minor = d->sysminor * AOE_PARTITIONS;
234 gd->fops = &aoe_bdops; 230 gd->fops = &aoe_bdops;
@@ -246,6 +242,16 @@ aoeblk_gdalloc(void *vp)
246 242
247 add_disk(gd); 243 add_disk(gd);
248 aoedisk_add_sysfs(d); 244 aoedisk_add_sysfs(d);
245 return;
246
247err_mempool:
248 mempool_destroy(d->bufpool);
249err_disk:
250 put_disk(gd);
251err:
252 spin_lock_irqsave(&d->lock, flags);
253 d->flags &= ~DEVFL_GDALLOC;
254 spin_unlock_irqrestore(&d->lock, flags);
249} 255}
250 256
251void 257void