]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Jan 2013 19:37:27 +0000 (11:37 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 14 Jan 2013 19:37:27 +0000 (11:37 -0800)
added patches:
aoe-do-not-call-bdi_init-after-blk_alloc_queue.patch
ext4-do-not-try-to-write-superblock-on-ro-remount-w-o-journal.patch
ext4-fix-extent-tree-corruption-caused-by-hole-punch.patch
ext4-lock-i_mutex-when-truncating-orphan-inodes.patch
jbd2-fix-assertion-failure-in-jbd2_journal_flush.patch
thp-memcg-split-hugepage-for-memcg-oom-on-cow.patch
udf-don-t-increment-lenextents-while-writing-to-a-hole.patch
udf-fix-memory-leak-while-allocating-blocks-during-write.patch
x86-amd-disable-way-access-filter-on-piledriver-cpus.patch

queue-3.0/aoe-do-not-call-bdi_init-after-blk_alloc_queue.patch [new file with mode: 0644]
queue-3.0/ext4-do-not-try-to-write-superblock-on-ro-remount-w-o-journal.patch [new file with mode: 0644]
queue-3.0/ext4-fix-extent-tree-corruption-caused-by-hole-punch.patch [new file with mode: 0644]
queue-3.0/ext4-lock-i_mutex-when-truncating-orphan-inodes.patch [new file with mode: 0644]
queue-3.0/jbd2-fix-assertion-failure-in-jbd2_journal_flush.patch [new file with mode: 0644]
queue-3.0/series
queue-3.0/thp-memcg-split-hugepage-for-memcg-oom-on-cow.patch [new file with mode: 0644]
queue-3.0/udf-don-t-increment-lenextents-while-writing-to-a-hole.patch [new file with mode: 0644]
queue-3.0/udf-fix-memory-leak-while-allocating-blocks-during-write.patch [new file with mode: 0644]
queue-3.0/x86-amd-disable-way-access-filter-on-piledriver-cpus.patch [new file with mode: 0644]

diff --git a/queue-3.0/aoe-do-not-call-bdi_init-after-blk_alloc_queue.patch b/queue-3.0/aoe-do-not-call-bdi_init-after-blk_alloc_queue.patch
new file mode 100644 (file)
index 0000000..c970ed9
--- /dev/null
@@ -0,0 +1,73 @@
+From ecashin@coraid.com  Mon Jan 14 11:25:08 2013
+From: Ed Cashin <ecashin@coraid.com>
+Date: Sat, 12 Jan 2013 06:43:35 -0500
+Subject: aoe: do not call bdi_init after blk_alloc_queue
+To: stable@vger.kernel.org
+Cc: ecashin@coraid.com
+Message-ID: <05215162ab30011eecf7a5c28ceed233@coraid.com>
+
+From: Ed Cashin <ecashin@coraid.com>
+
+commit 0a41409c518083133e79015092585d68915865be upstream, but doesn't
+apply, so this version is different for older kernels than 3.7.x
+
+blk_alloc_queue has already done a bdi_init, so do not bdi_init
+again in aoeblk_gdalloc.  The extra call causes list corruption
+in the per-CPU backing dev info stats lists.
+
+Affected users see console WARNINGs about list_del corruption on
+percpu_counter_destroy when doing "rmmod aoe" or "aoeflush -a"
+when AoE targets have been detected and initialized by the
+system.
+
+The patch below applies to v3.6.11, with its v47 aoe driver.  It
+is expected to apply to all currently maintained stable kernels
+except 3.7.y.  A related but different fix has been posted for
+3.7.y.
+
+References:
+
+  RedHat bugzilla ticket with original report
+  https://bugzilla.redhat.com/show_bug.cgi?id=853064
+
+  LKML discussion of bug and fix
+  http://thread.gmane.org/gmane.linux.kernel/1416336/focus=1416497
+
+Reported-by: Josh Boyer <jwboyer@redhat.com>
+Signed-off-by: Ed Cashin <ecashin@coraid.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/block/aoe/aoe.h    |    2 +-
+ drivers/block/aoe/aoeblk.c |    5 -----
+ 2 files changed, 1 insertion(+), 6 deletions(-)
+
+--- a/drivers/block/aoe/aoe.h
++++ b/drivers/block/aoe/aoe.h
+@@ -1,5 +1,5 @@
+ /* Copyright (c) 2007 Coraid, Inc.  See COPYING for GPL terms. */
+-#define VERSION "47"
++#define VERSION "47q"
+ #define AOE_MAJOR 152
+ #define DEVICE_NAME "aoe"
+--- a/drivers/block/aoe/aoeblk.c
++++ b/drivers/block/aoe/aoeblk.c
+@@ -277,8 +277,6 @@ aoeblk_gdalloc(void *vp)
+               goto err_mempool;
+       blk_queue_make_request(d->blkq, aoeblk_make_request);
+       d->blkq->backing_dev_info.name = "aoe";
+-      if (bdi_init(&d->blkq->backing_dev_info))
+-              goto err_blkq;
+       spin_lock_irqsave(&d->lock, flags);
+       gd->major = AOE_MAJOR;
+       gd->first_minor = d->sysminor * AOE_PARTITIONS;
+@@ -299,9 +297,6 @@ 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);
+ err_disk:
diff --git a/queue-3.0/ext4-do-not-try-to-write-superblock-on-ro-remount-w-o-journal.patch b/queue-3.0/ext4-do-not-try-to-write-superblock-on-ro-remount-w-o-journal.patch
new file mode 100644 (file)
index 0000000..a6ba5f8
--- /dev/null
@@ -0,0 +1,47 @@
+From d096ad0f79a782935d2e06ae8fb235e8c5397775 Mon Sep 17 00:00:00 2001
+From: Michael Tokarev <mjt@tls.msk.ru>
+Date: Tue, 25 Dec 2012 14:08:16 -0500
+Subject: ext4: do not try to write superblock on ro remount w/o journal
+
+From: Michael Tokarev <mjt@tls.msk.ru>
+
+commit d096ad0f79a782935d2e06ae8fb235e8c5397775 upstream.
+
+When a journal-less ext4 filesystem is mounted on a read-only block
+device (blockdev --setro will do), each remount (for other, unrelated,
+flags, like suid=>nosuid etc) results in a series of scary messages
+from kernel telling about I/O errors on the device.
+
+This is becauese of the following code ext4_remount():
+
+       if (sbi->s_journal == NULL)
+                ext4_commit_super(sb, 1);
+
+at the end of remount procedure, which forces writing (flushing) of
+a superblock regardless whenever it is dirty or not, if the filesystem
+is readonly or not, and whenever the device itself is readonly or not.
+
+We only need call ext4_commit_super when the file system had been
+previously mounted read/write.
+
+Thanks to Eric Sandeen for help in diagnosing this issue.
+
+Signed-off-By: Michael Tokarev <mjt@tls.msk.ru>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/super.c |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/fs/ext4/super.c
++++ b/fs/ext4/super.c
+@@ -4438,7 +4438,7 @@ static int ext4_remount(struct super_blo
+       }
+       ext4_setup_system_zone(sb);
+-      if (sbi->s_journal == NULL)
++      if (sbi->s_journal == NULL && !(old_sb_flags & MS_RDONLY))
+               ext4_commit_super(sb, 1);
+ #ifdef CONFIG_QUOTA
diff --git a/queue-3.0/ext4-fix-extent-tree-corruption-caused-by-hole-punch.patch b/queue-3.0/ext4-fix-extent-tree-corruption-caused-by-hole-punch.patch
new file mode 100644 (file)
index 0000000..58cf134
--- /dev/null
@@ -0,0 +1,78 @@
+From c36575e663e302dbaa4d16b9c72d2c9a913a9aef Mon Sep 17 00:00:00 2001
+From: Forrest Liu <forrestl@synology.com>
+Date: Mon, 17 Dec 2012 09:55:39 -0500
+Subject: ext4: fix extent tree corruption caused by hole punch
+
+From: Forrest Liu <forrestl@synology.com>
+
+commit c36575e663e302dbaa4d16b9c72d2c9a913a9aef upstream.
+
+When depth of extent tree is greater than 1, logical start value of
+interior node is not correctly updated in ext4_ext_rm_idx.
+
+Signed-off-by: Forrest Liu <forrestl@synology.com>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Reviewed-by: Ashish Sangwan <ashishsangwan2@gmail.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/extents.c |   22 ++++++++++++++++++----
+ 1 file changed, 18 insertions(+), 4 deletions(-)
+
+--- a/fs/ext4/extents.c
++++ b/fs/ext4/extents.c
+@@ -2140,13 +2140,14 @@ ext4_ext_in_cache(struct inode *inode, e
+  * last index in the block only.
+  */
+ static int ext4_ext_rm_idx(handle_t *handle, struct inode *inode,
+-                      struct ext4_ext_path *path)
++                      struct ext4_ext_path *path, int depth)
+ {
+       int err;
+       ext4_fsblk_t leaf;
+       /* free index block */
+-      path--;
++      depth--;
++      path = path + depth;
+       leaf = ext4_idx_pblock(path->p_idx);
+       if (unlikely(path->p_hdr->eh_entries == 0)) {
+               EXT4_ERROR_INODE(inode, "path->p_hdr->eh_entries == 0");
+@@ -2162,6 +2163,19 @@ static int ext4_ext_rm_idx(handle_t *han
+       ext_debug("index is empty, remove it, free block %llu\n", leaf);
+       ext4_free_blocks(handle, inode, NULL, leaf, 1,
+                        EXT4_FREE_BLOCKS_METADATA | EXT4_FREE_BLOCKS_FORGET);
++
++      while (--depth >= 0) {
++              if (path->p_idx != EXT_FIRST_INDEX(path->p_hdr))
++                      break;
++              path--;
++              err = ext4_ext_get_access(handle, inode, path);
++              if (err)
++                      break;
++              path->p_idx->ei_block = (path+1)->p_idx->ei_block;
++              err = ext4_ext_dirty(handle, inode, path);
++              if (err)
++                      break;
++      }
+       return err;
+ }
+@@ -2509,7 +2523,7 @@ ext4_ext_rm_leaf(handle_t *handle, struc
+       /* if this leaf is free, then we should
+        * remove it from index block above */
+       if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL)
+-              err = ext4_ext_rm_idx(handle, inode, path + depth);
++              err = ext4_ext_rm_idx(handle, inode, path, depth);
+ out:
+       return err;
+@@ -2639,7 +2653,7 @@ again:
+                               /* index is empty, remove it;
+                                * handle must be already prepared by the
+                                * truncatei_leaf() */
+-                              err = ext4_ext_rm_idx(handle, inode, path + i);
++                              err = ext4_ext_rm_idx(handle, inode, path, i);
+                       }
+                       /* root level has p_bh == NULL, brelse() eats this */
+                       brelse(path[i].p_bh);
diff --git a/queue-3.0/ext4-lock-i_mutex-when-truncating-orphan-inodes.patch b/queue-3.0/ext4-lock-i_mutex-when-truncating-orphan-inodes.patch
new file mode 100644 (file)
index 0000000..93d3835
--- /dev/null
@@ -0,0 +1,37 @@
+From 721e3eba21e43532e438652dd8f1fcdfce3187e7 Mon Sep 17 00:00:00 2001
+From: Theodore Ts'o <tytso@mit.edu>
+Date: Thu, 27 Dec 2012 01:42:48 -0500
+Subject: ext4: lock i_mutex when truncating orphan inodes
+
+From: Theodore Ts'o <tytso@mit.edu>
+
+commit 721e3eba21e43532e438652dd8f1fcdfce3187e7 upstream.
+
+Commit c278531d39 added a warning when ext4_flush_unwritten_io() is
+called without i_mutex being taken.  It had previously not been taken
+during orphan cleanup since races weren't possible at that point in
+the mount process, but as a result of this c278531d39, we will now see
+a kernel WARN_ON in this case.  Take the i_mutex in
+ext4_orphan_cleanup() to suppress this warning.
+
+Reported-by: Alexander Beregalov <a.beregalov@gmail.com>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Reviewed-by: Zheng Liu <wenqing.lz@taobao.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/super.c |    2 ++
+ 1 file changed, 2 insertions(+)
+
+--- a/fs/ext4/super.c
++++ b/fs/ext4/super.c
+@@ -2204,7 +2204,9 @@ static void ext4_orphan_cleanup(struct s
+                               __func__, inode->i_ino, inode->i_size);
+                       jbd_debug(2, "truncating inode %lu to %lld bytes\n",
+                                 inode->i_ino, inode->i_size);
++                      mutex_lock(&inode->i_mutex);
+                       ext4_truncate(inode);
++                      mutex_unlock(&inode->i_mutex);
+                       nr_truncates++;
+               } else {
+                       ext4_msg(sb, KERN_DEBUG,
diff --git a/queue-3.0/jbd2-fix-assertion-failure-in-jbd2_journal_flush.patch b/queue-3.0/jbd2-fix-assertion-failure-in-jbd2_journal_flush.patch
new file mode 100644 (file)
index 0000000..8eb62b5
--- /dev/null
@@ -0,0 +1,58 @@
+From d7961c7fa4d2e3c3f12be67e21ba8799b5a7238a Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Fri, 21 Dec 2012 00:15:51 -0500
+Subject: jbd2: fix assertion failure in jbd2_journal_flush()
+
+From: Jan Kara <jack@suse.cz>
+
+commit d7961c7fa4d2e3c3f12be67e21ba8799b5a7238a upstream.
+
+The following race is possible between start_this_handle() and someone
+calling jbd2_journal_flush().
+
+Process A                              Process B
+start_this_handle().
+  if (journal->j_barrier_count) # false
+  if (!journal->j_running_transaction) { #true
+    read_unlock(&journal->j_state_lock);
+                                       jbd2_journal_lock_updates()
+                                       jbd2_journal_flush()
+                                         write_lock(&journal->j_state_lock);
+                                         if (journal->j_running_transaction) {
+                                           # false
+                                         ... wait for committing trans ...
+                                         write_unlock(&journal->j_state_lock);
+    ...
+    write_lock(&journal->j_state_lock);
+    if (!journal->j_running_transaction) { # true
+      jbd2_get_transaction(journal, new_transaction);
+    write_unlock(&journal->j_state_lock);
+    goto repeat; # eventually blocks on j_barrier_count > 0
+                                         ...
+                                         J_ASSERT(!journal->j_running_transaction);
+                                           # fails
+
+We fix the race by rechecking j_barrier_count after reacquiring j_state_lock
+in exclusive mode.
+
+Reported-by: yjwsignal@empal.com
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/jbd2/transaction.c |    3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+--- a/fs/jbd2/transaction.c
++++ b/fs/jbd2/transaction.c
+@@ -178,7 +178,8 @@ repeat:
+               if (!new_transaction)
+                       goto alloc_transaction;
+               write_lock(&journal->j_state_lock);
+-              if (!journal->j_running_transaction) {
++              if (!journal->j_running_transaction &&
++                  !journal->j_barrier_count) {
+                       jbd2_get_transaction(journal, new_transaction);
+                       new_transaction = NULL;
+               }
index eda0534d8f7c5669d1316fecd4ea8f26a218a65c..3a2047ebb201d5e085315cd485828fe1be26d9ae 100644 (file)
@@ -30,3 +30,12 @@ staging-vt6656-64-bit-fixes-fix-long-warning-messages.patch
 staging-vt6656-64bit-fixes-key.c-h-change-unsigned-long-to-u32.patch
 staging-vt6656-64bit-fixes-vcommandtimerwait-change-calculation-of-timer.patch
 video-mxsfb-fix-crash-when-unblanking-the-display.patch
+ext4-fix-extent-tree-corruption-caused-by-hole-punch.patch
+jbd2-fix-assertion-failure-in-jbd2_journal_flush.patch
+ext4-do-not-try-to-write-superblock-on-ro-remount-w-o-journal.patch
+ext4-lock-i_mutex-when-truncating-orphan-inodes.patch
+aoe-do-not-call-bdi_init-after-blk_alloc_queue.patch
+udf-fix-memory-leak-while-allocating-blocks-during-write.patch
+udf-don-t-increment-lenextents-while-writing-to-a-hole.patch
+thp-memcg-split-hugepage-for-memcg-oom-on-cow.patch
+x86-amd-disable-way-access-filter-on-piledriver-cpus.patch
diff --git a/queue-3.0/thp-memcg-split-hugepage-for-memcg-oom-on-cow.patch b/queue-3.0/thp-memcg-split-hugepage-for-memcg-oom-on-cow.patch
new file mode 100644 (file)
index 0000000..308a0c4
--- /dev/null
@@ -0,0 +1,90 @@
+From 1f1d06c34f7675026326cd9f39ff91e4555cf355 Mon Sep 17 00:00:00 2001
+From: David Rientjes <rientjes@google.com>
+Date: Tue, 29 May 2012 15:06:23 -0700
+Subject: thp, memcg: split hugepage for memcg oom on cow
+
+From: David Rientjes <rientjes@google.com>
+
+commit 1f1d06c34f7675026326cd9f39ff91e4555cf355 upstream.
+
+On COW, a new hugepage is allocated and charged to the memcg.  If the
+system is oom or the charge to the memcg fails, however, the fault
+handler will return VM_FAULT_OOM which results in an oom kill.
+
+Instead, it's possible to fallback to splitting the hugepage so that the
+COW results only in an order-0 page being allocated and charged to the
+memcg which has a higher liklihood to succeed.  This is expensive
+because the hugepage must be split in the page fault handler, but it is
+much better than unnecessarily oom killing a process.
+
+Signed-off-by: David Rientjes <rientjes@google.com>
+Cc: Andrea Arcangeli <aarcange@redhat.com>
+Cc: Johannes Weiner <jweiner@redhat.com>
+Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
+Cc: Michal Hocko <mhocko@suse.cz>
+Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ mm/huge_memory.c |    3 +++
+ mm/memory.c      |   18 +++++++++++++++---
+ 2 files changed, 18 insertions(+), 3 deletions(-)
+
+--- a/mm/huge_memory.c
++++ b/mm/huge_memory.c
+@@ -920,6 +920,8 @@ int do_huge_pmd_wp_page(struct mm_struct
+               count_vm_event(THP_FAULT_FALLBACK);
+               ret = do_huge_pmd_wp_page_fallback(mm, vma, address,
+                                                  pmd, orig_pmd, page, haddr);
++              if (ret & VM_FAULT_OOM)
++                      split_huge_page(page);
+               put_page(page);
+               goto out;
+       }
+@@ -927,6 +929,7 @@ int do_huge_pmd_wp_page(struct mm_struct
+       if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) {
+               put_page(new_page);
++              split_huge_page(page);
+               put_page(page);
+               ret |= VM_FAULT_OOM;
+               goto out;
+--- a/mm/memory.c
++++ b/mm/memory.c
+@@ -3470,6 +3470,7 @@ int handle_mm_fault(struct mm_struct *mm
+       if (unlikely(is_vm_hugetlb_page(vma)))
+               return hugetlb_fault(mm, vma, address, flags);
++retry:
+       pgd = pgd_offset(mm, address);
+       pud = pud_alloc(mm, pgd, address);
+       if (!pud)
+@@ -3483,13 +3484,24 @@ int handle_mm_fault(struct mm_struct *mm
+                                                         pmd, flags);
+       } else {
+               pmd_t orig_pmd = *pmd;
++              int ret;
++
+               barrier();
+               if (pmd_trans_huge(orig_pmd)) {
+                       if (flags & FAULT_FLAG_WRITE &&
+                           !pmd_write(orig_pmd) &&
+-                          !pmd_trans_splitting(orig_pmd))
+-                              return do_huge_pmd_wp_page(mm, vma, address,
+-                                                         pmd, orig_pmd);
++                          !pmd_trans_splitting(orig_pmd)) {
++                              ret = do_huge_pmd_wp_page(mm, vma, address, pmd,
++                                                        orig_pmd);
++                              /*
++                               * If COW results in an oom, the huge pmd will
++                               * have been split, so retry the fault on the
++                               * pte for a smaller charge.
++                               */
++                              if (unlikely(ret & VM_FAULT_OOM))
++                                      goto retry;
++                              return ret;
++                      }
+                       return 0;
+               }
+       }
diff --git a/queue-3.0/udf-don-t-increment-lenextents-while-writing-to-a-hole.patch b/queue-3.0/udf-don-t-increment-lenextents-while-writing-to-a-hole.patch
new file mode 100644 (file)
index 0000000..c6922c6
--- /dev/null
@@ -0,0 +1,61 @@
+From fb719c59bdb4fca86ee1fd1f42ab3735ca12b6b2 Mon Sep 17 00:00:00 2001
+From: Namjae Jeon <namjae.jeon@samsung.com>
+Date: Wed, 10 Oct 2012 00:09:12 +0900
+Subject: udf: don't increment lenExtents while writing to a hole
+
+From: Namjae Jeon <namjae.jeon@samsung.com>
+
+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 <namjae.jeon@samsung.com>
+Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Shuah Khan <shuah.khan@hp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/udf/inode.c |    7 +++++--
+ 1 file changed, 5 insertions(+), 2 deletions(-)
+
+--- a/fs/udf/inode.c
++++ b/fs/udf/inode.c
+@@ -575,6 +575,7 @@ static struct buffer_head *inode_getblk(
+       struct udf_inode_info *iinfo = UDF_I(inode);
+       int goal = 0, pgoal = iinfo->i_location.logicalBlockNum;
+       int lastblock = 0;
++      bool isBeyondEOF;
+       prev_epos.offset = udf_file_entry_alloc_offset(inode);
+       prev_epos.block = iinfo->i_location;
+@@ -653,7 +654,7 @@ static struct buffer_head *inode_getblk(
+       /* Are we beyond EOF? */
+       if (etype == -1) {
+               int ret;
+-
++              isBeyondEOF = 1;
+               if (count) {
+                       if (c)
+                               laarr[0] = laarr[1];
+@@ -696,6 +697,7 @@ static struct buffer_head *inode_getblk(
+               endnum = c + 1;
+               lastblock = 1;
+       } else {
++              isBeyondEOF = 0;
+               endnum = startnum = ((count > 2) ? 2 : count);
+               /* if the current extent is in position 0,
+@@ -743,7 +745,8 @@ static struct buffer_head *inode_getblk(
+                       *err = -ENOSPC;
+                       return NULL;
+               }
+-              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.0/udf-fix-memory-leak-while-allocating-blocks-during-write.patch b/queue-3.0/udf-fix-memory-leak-while-allocating-blocks-during-write.patch
new file mode 100644 (file)
index 0000000..4d78370
--- /dev/null
@@ -0,0 +1,41 @@
+From 2fb7d99d0de3fd8ae869f35ab682581d8455887a Mon Sep 17 00:00:00 2001
+From: Namjae Jeon <namjae.jeon@samsung.com>
+Date: Wed, 10 Oct 2012 00:08:56 +0900
+Subject: udf: fix memory leak while allocating blocks during write
+
+From: Namjae Jeon <namjae.jeon@samsung.com>
+
+commit 2fb7d99d0de3fd8ae869f35ab682581d8455887a upstream.
+
+Need to brelse the buffer_head stored in cur_epos and next_epos.
+
+Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
+Signed-off-by: Ashish Sangwan <a.sangwan@samsung.com>
+Signed-off-by: Jan Kara <jack@suse.cz>
+Signed-off-by: Shuah Khan <shuah.khan@hp.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/udf/inode.c |    4 ++++
+ 1 file changed, 4 insertions(+)
+
+--- a/fs/udf/inode.c
++++ b/fs/udf/inode.c
+@@ -738,6 +738,8 @@ static struct buffer_head *inode_getblk(
+                               goal, err);
+               if (!newblocknum) {
+                       brelse(prev_epos.bh);
++                      brelse(cur_epos.bh);
++                      brelse(next_epos.bh);
+                       *err = -ENOSPC;
+                       return NULL;
+               }
+@@ -768,6 +770,8 @@ static struct buffer_head *inode_getblk(
+       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);
diff --git a/queue-3.0/x86-amd-disable-way-access-filter-on-piledriver-cpus.patch b/queue-3.0/x86-amd-disable-way-access-filter-on-piledriver-cpus.patch
new file mode 100644 (file)
index 0000000..0dcd815
--- /dev/null
@@ -0,0 +1,70 @@
+From 2bbf0a1427c377350f001fbc6260995334739ad7 Mon Sep 17 00:00:00 2001
+From: Andre Przywara <andre.przywara@amd.com>
+Date: Wed, 31 Oct 2012 17:20:50 +0100
+Subject: x86, amd: Disable way access filter on Piledriver CPUs
+
+From: Andre Przywara <andre.przywara@amd.com>
+
+commit 2bbf0a1427c377350f001fbc6260995334739ad7 upstream.
+
+The Way Access Filter in recent AMD CPUs may hurt the performance of
+some workloads, caused by aliasing issues in the L1 cache.
+This patch disables it on the affected CPUs.
+
+The issue is similar to that one of last year:
+http://lkml.indiana.edu/hypermail/linux/kernel/1107.3/00041.html
+This new patch does not replace the old one, we just need another
+quirk for newer CPUs.
+
+The performance penalty without the patch depends on the
+circumstances, but is a bit less than the last year's 3%.
+
+The workloads affected would be those that access code from the same
+physical page under different virtual addresses, so different
+processes using the same libraries with ASLR or multiple instances of
+PIE-binaries. The code needs to be accessed simultaneously from both
+cores of the same compute unit.
+
+More details can be found here:
+http://developer.amd.com/Assets/SharedL1InstructionCacheonAMD15hCPU.pdf
+
+CPUs affected are anything with the core known as Piledriver.
+That includes the new parts of the AMD A-Series (aka Trinity) and the
+just released new CPUs of the FX-Series (aka Vishera).
+The model numbering is a bit odd here: FX CPUs have model 2,
+A-Series has model 10h, with possible extensions to 1Fh. Hence the
+range of model ids.
+
+Signed-off-by: Andre Przywara <osp@andrep.de>
+Link: http://lkml.kernel.org/r/1351700450-9277-1-git-send-email-osp@andrep.de
+Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
+Signed-off-by: CAI Qian <caiqian@redhat.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ arch/x86/kernel/cpu/amd.c |   14 ++++++++++++++
+ 1 file changed, 14 insertions(+)
+
+--- a/arch/x86/kernel/cpu/amd.c
++++ b/arch/x86/kernel/cpu/amd.c
+@@ -568,6 +568,20 @@ static void __cpuinit init_amd(struct cp
+               }
+       }
++      /*
++       * The way access filter has a performance penalty on some workloads.
++       * Disable it on the affected CPUs.
++       */
++      if ((c->x86 == 0x15) &&
++          (c->x86_model >= 0x02) && (c->x86_model < 0x20)) {
++              u64 val;
++
++              if (!rdmsrl_safe(0xc0011021, &val) && !(val & 0x1E)) {
++                      val |= 0x1E;
++                      checking_wrmsrl(0xc0011021, val);
++              }
++      }
++
+       cpu_detect_cache_sizes(c);
+       /* Multi core CPU? */