From ee4bfad2d9ae1152b2ea6fc6cd86653bef206933 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Mon, 14 Jan 2013 11:38:10 -0800 Subject: [PATCH] 3.7-stable patches added patches: aoe-remove-vestigial-request-queue-allocation.patch udf-don-t-increment-lenextents-while-writing-to-a-hole.patch udf-fix-memory-leak-while-allocating-blocks-during-write.patch --- ...e-vestigial-request-queue-allocation.patch | 70 +++++++++++++++++++ queue-3.7/series | 3 + ...t-lenextents-while-writing-to-a-hole.patch | 61 ++++++++++++++++ ...while-allocating-blocks-during-write.patch | 41 +++++++++++ 4 files changed, 175 insertions(+) create mode 100644 queue-3.7/aoe-remove-vestigial-request-queue-allocation.patch create mode 100644 queue-3.7/udf-don-t-increment-lenextents-while-writing-to-a-hole.patch create mode 100644 queue-3.7/udf-fix-memory-leak-while-allocating-blocks-during-write.patch diff --git a/queue-3.7/aoe-remove-vestigial-request-queue-allocation.patch b/queue-3.7/aoe-remove-vestigial-request-queue-allocation.patch new file mode 100644 index 00000000000..07aebd2ff53 --- /dev/null +++ b/queue-3.7/aoe-remove-vestigial-request-queue-allocation.patch @@ -0,0 +1,70 @@ +From 0a41409c518083133e79015092585d68915865be Mon Sep 17 00:00:00 2001 +From: Ed Cashin +Date: Mon, 17 Dec 2012 16:03:58 -0800 +Subject: aoe: remove vestigial request queue allocation + +From: Ed Cashin + +commit 0a41409c518083133e79015092585d68915865be upstream. + +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 +7135a71b19be ("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: Ed Cashin +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/block/aoe/aoeblk.c | 17 ++++------------- + 1 file changed, 4 insertions(+), 13 deletions(-) + +--- a/drivers/block/aoe/aoeblk.c ++++ b/drivers/block/aoe/aoeblk.c +@@ -231,18 +231,12 @@ aoeblk_gdalloc(void *vp) + if (q == NULL) { + pr_err("aoe: cannot allocate block queue for %ld.%d\n", + d->aoemajor, d->aoeminor); +- mempool_destroy(mp); +- goto err_disk; ++ goto err_mempool; + } + +- 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); +- 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; + d->bufpool = mp; + d->blkq = gd->queue = q; +@@ -265,11 +259,8 @@ aoeblk_gdalloc(void *vp) + aoedisk_add_sysfs(d); + return; + +-err_blkq: +- blk_cleanup_queue(d->blkq); +- d->blkq = NULL; + err_mempool: +- mempool_destroy(d->bufpool); ++ mempool_destroy(mp); + err_disk: + put_disk(gd); + err: diff --git a/queue-3.7/series b/queue-3.7/series index 268d091871b..1d2480c98ad 100644 --- a/queue-3.7/series +++ b/queue-3.7/series @@ -113,3 +113,6 @@ ext4-do-not-try-to-write-superblock-on-ro-remount-w-o-journal.patch ext4-lock-i_mutex-when-truncating-orphan-inodes.patch ext4-avoid-hang-when-mounting-non-journal-filesystems-with-orphan-list.patch ext4-release-buffer-in-failed-path-in-dx_probe.patch +aoe-remove-vestigial-request-queue-allocation.patch +udf-fix-memory-leak-while-allocating-blocks-during-write.patch +udf-don-t-increment-lenextents-while-writing-to-a-hole.patch diff --git a/queue-3.7/udf-don-t-increment-lenextents-while-writing-to-a-hole.patch b/queue-3.7/udf-don-t-increment-lenextents-while-writing-to-a-hole.patch new file mode 100644 index 00000000000..c3f13d32be0 --- /dev/null +++ b/queue-3.7/udf-don-t-increment-lenextents-while-writing-to-a-hole.patch @@ -0,0 +1,61 @@ +From fb719c59bdb4fca86ee1fd1f42ab3735ca12b6b2 Mon Sep 17 00:00:00 2001 +From: Namjae Jeon +Date: Wed, 10 Oct 2012 00:09:12 +0900 +Subject: udf: don't increment lenExtents while writing to a hole + +From: Namjae Jeon + +commit fb719c59bdb4fca86ee1fd1f42ab3735ca12b6b2 upstream. + +Incrementing lenExtents even while writing to a hole is bad +for performance as calls to udf_discard_prealloc and +udf_truncate_tail_extent would not return from start if +isize != lenExtents + +Signed-off-by: Namjae Jeon +Signed-off-by: Ashish Sangwan +Signed-off-by: Jan Kara +Signed-off-by: Shuah Khan +Signed-off-by: Greg Kroah-Hartman + +--- + fs/udf/inode.c | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +--- a/fs/udf/inode.c ++++ b/fs/udf/inode.c +@@ -601,6 +601,7 @@ static sector_t inode_getblk(struct inod + struct udf_inode_info *iinfo = UDF_I(inode); + int goal = 0, pgoal = iinfo->i_location.logicalBlockNum; + int lastblock = 0; ++ bool isBeyondEOF; + + *err = 0; + *new = 0; +@@ -680,7 +681,7 @@ static sector_t inode_getblk(struct inod + /* Are we beyond EOF? */ + if (etype == -1) { + int ret; +- ++ isBeyondEOF = 1; + if (count) { + if (c) + laarr[0] = laarr[1]; +@@ -723,6 +724,7 @@ static sector_t inode_getblk(struct inod + endnum = c + 1; + lastblock = 1; + } else { ++ isBeyondEOF = 0; + endnum = startnum = ((count > 2) ? 2 : count); + + /* if the current extent is in position 0, +@@ -770,7 +772,8 @@ static sector_t inode_getblk(struct inod + *err = -ENOSPC; + return 0; + } +- iinfo->i_lenExtents += inode->i_sb->s_blocksize; ++ if (isBeyondEOF) ++ iinfo->i_lenExtents += inode->i_sb->s_blocksize; + } + + /* if the extent the requsted block is located in contains multiple diff --git a/queue-3.7/udf-fix-memory-leak-while-allocating-blocks-during-write.patch b/queue-3.7/udf-fix-memory-leak-while-allocating-blocks-during-write.patch new file mode 100644 index 00000000000..ec69df341af --- /dev/null +++ b/queue-3.7/udf-fix-memory-leak-while-allocating-blocks-during-write.patch @@ -0,0 +1,41 @@ +From 2fb7d99d0de3fd8ae869f35ab682581d8455887a Mon Sep 17 00:00:00 2001 +From: Namjae Jeon +Date: Wed, 10 Oct 2012 00:08:56 +0900 +Subject: udf: fix memory leak while allocating blocks during write + +From: Namjae Jeon + +commit 2fb7d99d0de3fd8ae869f35ab682581d8455887a upstream. + +Need to brelse the buffer_head stored in cur_epos and next_epos. + +Signed-off-by: Namjae Jeon +Signed-off-by: Ashish Sangwan +Signed-off-by: Jan Kara +Signed-off-by: Shuah Khan +Signed-off-by: Greg Kroah-Hartman + +--- + fs/udf/inode.c | 4 ++++ + 1 file changed, 4 insertions(+) + +--- a/fs/udf/inode.c ++++ b/fs/udf/inode.c +@@ -765,6 +765,8 @@ static sector_t inode_getblk(struct inod + goal, err); + if (!newblocknum) { + brelse(prev_epos.bh); ++ brelse(cur_epos.bh); ++ brelse(next_epos.bh); + *err = -ENOSPC; + return 0; + } +@@ -795,6 +797,8 @@ static sector_t inode_getblk(struct inod + udf_update_extents(inode, laarr, startnum, endnum, &prev_epos); + + brelse(prev_epos.bh); ++ brelse(cur_epos.bh); ++ brelse(next_epos.bh); + + newblock = udf_get_pblock(inode->i_sb, newblocknum, + iinfo->i_location.partitionReferenceNum, 0); -- 2.47.3