提交 0a41409c 编写于 作者: E Ed Cashin 提交者: Linus Torvalds

aoe: remove vestigial request queue allocation

Before the aoe driver was an I/O request handler, it was a
make_request-style block driver.  Even so, there was a problem where
sysfs expected a request queue to exist, so one was provided in commit
7135a71b ("aoe: allocate unused request_queue for sysfs").

During the transition to the request-handler style, a patch was merged
that was based on a driver without the noop queue, and the noop queue
remained in place after the patch was merged, even though a new
functional queue was introduced by the patch, allocated through
blk_init_queue.

The user impact is a memory leak proportional to the number of AoE
targets discovered.  This patch removes the memory leak and cleans up
vestiges of the old do-nothing queue from the aoeblk_gdalloc function.
Signed-off-by: NEd Cashin <ecashin@coraid.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 fe7252bf
...@@ -278,18 +278,12 @@ aoeblk_gdalloc(void *vp) ...@@ -278,18 +278,12 @@ aoeblk_gdalloc(void *vp)
if (q == NULL) { if (q == NULL) {
pr_err("aoe: cannot allocate block queue for %ld.%d\n", pr_err("aoe: cannot allocate block queue for %ld.%d\n",
d->aoemajor, d->aoeminor); d->aoemajor, d->aoeminor);
mempool_destroy(mp); goto err_mempool;
goto err_disk;
} }
d->blkq = blk_alloc_queue(GFP_KERNEL);
if (!d->blkq)
goto err_mempool;
d->blkq->backing_dev_info.name = "aoe";
if (bdi_init(&d->blkq->backing_dev_info))
goto err_blkq;
spin_lock_irqsave(&d->lock, flags); spin_lock_irqsave(&d->lock, flags);
blk_queue_max_hw_sectors(d->blkq, BLK_DEF_MAX_SECTORS); blk_queue_max_hw_sectors(q, BLK_DEF_MAX_SECTORS);
q->backing_dev_info.name = "aoe";
q->backing_dev_info.ra_pages = READ_AHEAD / PAGE_CACHE_SIZE; q->backing_dev_info.ra_pages = READ_AHEAD / PAGE_CACHE_SIZE;
d->bufpool = mp; d->bufpool = mp;
d->blkq = gd->queue = q; d->blkq = gd->queue = q;
...@@ -314,11 +308,8 @@ aoeblk_gdalloc(void *vp) ...@@ -314,11 +308,8 @@ aoeblk_gdalloc(void *vp)
aoedisk_add_sysfs(d); aoedisk_add_sysfs(d);
return; return;
err_blkq:
blk_cleanup_queue(d->blkq);
d->blkq = NULL;
err_mempool: err_mempool:
mempool_destroy(d->bufpool); mempool_destroy(mp);
err_disk: err_disk:
put_disk(gd); put_disk(gd);
err: err:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册