From: Greg Kroah-Hartman Date: Fri, 1 Jun 2012 08:20:35 +0000 (+0800) Subject: 3.4-stable patches X-Git-Tag: v3.0.34~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e2bdd0a0b911dc2badb1689cea2ccb2e12b307e0;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: exofs-fix-crash-on-very-early-io-errors.patch microblaze-do-not-select-generic_gpio-by-default.patch mm-consider-all-swapped-back-pages-in-used-once-logic.patch mm-fix-null-ptr-deref-when-walking-hugepages.patch mm-fork-fix-overflow-in-vma-length-when-copying-mmap-on-clone.patch scsi-fix-dm-multipath-starvation-when-scsi-host-is-busy.patch scsi-fix-scsi_wait_scan.patch --- diff --git a/queue-3.4/exofs-fix-crash-on-very-early-io-errors.patch b/queue-3.4/exofs-fix-crash-on-very-early-io-errors.patch new file mode 100644 index 00000000000..801298b7ced --- /dev/null +++ b/queue-3.4/exofs-fix-crash-on-very-early-io-errors.patch @@ -0,0 +1,46 @@ +From 6abe4a87f7bc7978705c386dbba0ca0c7790b3ec Mon Sep 17 00:00:00 2001 +From: Boaz Harrosh +Date: Wed, 16 May 2012 14:22:21 +0300 +Subject: exofs: Fix CRASH on very early IO errors. + +From: Boaz Harrosh + +commit 6abe4a87f7bc7978705c386dbba0ca0c7790b3ec upstream. + +If at exofs_fill_super() we had an early termination +do to any error, like an IO error while reading the +super-block. We would crash inside exofs_free_sbi(). + +This is because sbi->oc.numdevs was set to 1, before +we actually have a device table at all. + +Fix it by moving the sbi->oc.numdevs = 1 to after the +allocation of the device table. + +Reported-by: Johannes Schild + +Signed-off-by: Boaz Harrosh +Signed-off-by: Greg Kroah-Hartman + +--- + fs/exofs/super.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/exofs/super.c ++++ b/fs/exofs/super.c +@@ -745,7 +745,6 @@ static int exofs_fill_super(struct super + sbi->one_comp.obj.partition = opts->pid; + sbi->one_comp.obj.id = 0; + exofs_make_credential(sbi->one_comp.cred, &sbi->one_comp.obj); +- sbi->oc.numdevs = 1; + sbi->oc.single_comp = EC_SINGLE_COMP; + sbi->oc.comps = &sbi->one_comp; + +@@ -804,6 +803,7 @@ static int exofs_fill_super(struct super + goto free_sbi; + + ore_comp_set_dev(&sbi->oc, 0, od); ++ sbi->oc.numdevs = 1; + } + + __sbi_read_stats(sbi); diff --git a/queue-3.4/microblaze-do-not-select-generic_gpio-by-default.patch b/queue-3.4/microblaze-do-not-select-generic_gpio-by-default.patch new file mode 100644 index 00000000000..a1fce509ea7 --- /dev/null +++ b/queue-3.4/microblaze-do-not-select-generic_gpio-by-default.patch @@ -0,0 +1,40 @@ +From 59516b07b4ffa7e607a5787674ea3c405f1b390c Mon Sep 17 00:00:00 2001 +From: Lars-Peter Clausen +Date: Mon, 9 Apr 2012 15:05:44 +0200 +Subject: microblaze: Do not select GENERIC_GPIO by default + +From: Lars-Peter Clausen + +commit 59516b07b4ffa7e607a5787674ea3c405f1b390c upstream. + +The microblaze architecture does not provide a native GPIO API implementation +nor requires GPIOLIB, but still selects GENERIC_GPIO by default. As a result the +following build error occurs, if GPIOLIB is not selected: + + include/asm-generic/gpio.h: In function 'gpio_get_value_cansleep': + include/asm-generic/gpio.h:218: error: implicit declaration of function '__gpio_get_value' + include/asm-generic/gpio.h: In function 'gpio_set_value_cansleep': + include/asm-generic/gpio.h:224: error: implicit declaration of function '__gpio_set_value' + +This patch addresses the issue by not selecting GENERIC_GPIO by default. This +causes the GPIO API to be stubbed out if no implementation is provided. + +Signed-off-by: Lars-Peter Clausen +Tested-by: Michal Simek +Signed-off-by: Greg Kroah-Hartman + +--- + arch/microblaze/Kconfig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/arch/microblaze/Kconfig ++++ b/arch/microblaze/Kconfig +@@ -57,7 +57,7 @@ config GENERIC_CLOCKEVENTS + def_bool y + + config GENERIC_GPIO +- def_bool y ++ bool + + config GENERIC_CSUM + def_bool y diff --git a/queue-3.4/mm-consider-all-swapped-back-pages-in-used-once-logic.patch b/queue-3.4/mm-consider-all-swapped-back-pages-in-used-once-logic.patch new file mode 100644 index 00000000000..14fa76e9ff9 --- /dev/null +++ b/queue-3.4/mm-consider-all-swapped-back-pages-in-used-once-logic.patch @@ -0,0 +1,63 @@ +From e48982734ea0500d1eba4f9d96195acc5406cad6 Mon Sep 17 00:00:00 2001 +From: Michal Hocko +Date: Tue, 29 May 2012 15:06:45 -0700 +Subject: mm: consider all swapped back pages in used-once logic + +From: Michal Hocko + +commit e48982734ea0500d1eba4f9d96195acc5406cad6 upstream. + +Commit 645747462435 ("vmscan: detect mapped file pages used only once") +made mapped pages have another round in inactive list because they might +be just short lived and so we could consider them again next time. This +heuristic helps to reduce pressure on the active list with a streaming +IO worklods. + +This patch fixes a regression introduced by this commit for heavy shmem +based workloads because unlike Anon pages, which are excluded from this +heuristic because they are usually long lived, shmem pages are handled +as a regular page cache. + +This doesn't work quite well, unfortunately, if the workload is mostly +backed by shmem (in memory database sitting on 80% of memory) with a +streaming IO in the background (backup - up to 20% of memory). Anon +inactive list is full of (dirty) shmem pages when watermarks are hit. +Shmem pages are kept in the inactive list (they are referenced) in the +first round and it is hard to reclaim anything else so we reach lower +scanning priorities very quickly which leads to an excessive swap out. + +Let's fix this by excluding all swap backed pages (they tend to be long +lived wrt. the regular page cache anyway) from used-once heuristic and +rather activate them if they are referenced. + +The customer's workload is shmem backed database (80% of RAM) and they +are measuring transactions/s with an IO in the background (20%). +Transactions touch more or less random rows in the table. The +transaction rate fell by a factor of 3 (in the worst case) because of +commit 64574746. This patch restores the previous numbers. + +Signed-off-by: Michal Hocko +Acked-by: Johannes Weiner +Cc: Mel Gorman +Cc: Minchan Kim +Cc: KAMEZAWA Hiroyuki +Reviewed-by: Rik van Riel +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/vmscan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/mm/vmscan.c ++++ b/mm/vmscan.c +@@ -722,7 +722,7 @@ static enum page_references page_check_r + return PAGEREF_RECLAIM; + + if (referenced_ptes) { +- if (PageAnon(page)) ++ if (PageSwapBacked(page)) + return PAGEREF_ACTIVATE; + /* + * All mapped pages start out with page table diff --git a/queue-3.4/mm-fix-null-ptr-deref-when-walking-hugepages.patch b/queue-3.4/mm-fix-null-ptr-deref-when-walking-hugepages.patch new file mode 100644 index 00000000000..74444102ca9 --- /dev/null +++ b/queue-3.4/mm-fix-null-ptr-deref-when-walking-hugepages.patch @@ -0,0 +1,44 @@ +From 08fa29d916c6e271ad13978cd993e7238c68db97 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 29 May 2012 15:06:15 -0700 +Subject: mm: fix NULL ptr deref when walking hugepages + +From: Sasha Levin + +commit 08fa29d916c6e271ad13978cd993e7238c68db97 upstream. + +A missing validation of the value returned by find_vma() could cause a +NULL ptr dereference when walking the pagetable. + +This is triggerable from usermode by a simple user by trying to read a +page info out of /proc/pid/pagemap which doesn't exist. + +Introduced by commit 025c5b2451e4 ("thp: optimize away unnecessary page +table locking"). + +Signed-off-by: Sasha Levin +Reviewed-by: Naoya Horiguchi +Cc: David Rientjes +Cc: Andi Kleen +Cc: Andrea Arcangeli +Cc: KOSAKI Motohiro +Cc: KAMEZAWA Hiroyuki +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/proc/task_mmu.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/proc/task_mmu.c ++++ b/fs/proc/task_mmu.c +@@ -784,7 +784,7 @@ static int pagemap_pte_range(pmd_t *pmd, + + /* find the first VMA at or above 'addr' */ + vma = find_vma(walk->mm, addr); +- if (pmd_trans_huge_lock(pmd, vma) == 1) { ++ if (vma && pmd_trans_huge_lock(pmd, vma) == 1) { + for (; addr != end; addr += PAGE_SIZE) { + unsigned long offset; + diff --git a/queue-3.4/mm-fork-fix-overflow-in-vma-length-when-copying-mmap-on-clone.patch b/queue-3.4/mm-fork-fix-overflow-in-vma-length-when-copying-mmap-on-clone.patch new file mode 100644 index 00000000000..8de79c141d0 --- /dev/null +++ b/queue-3.4/mm-fork-fix-overflow-in-vma-length-when-copying-mmap-on-clone.patch @@ -0,0 +1,77 @@ +From 7edc8b0ac16cbaed7cb4ea4c6b95ce98d2997e84 Mon Sep 17 00:00:00 2001 +From: Siddhesh Poyarekar +Date: Tue, 29 May 2012 15:06:22 -0700 +Subject: mm/fork: fix overflow in vma length when copying mmap on clone + +From: Siddhesh Poyarekar + +commit 7edc8b0ac16cbaed7cb4ea4c6b95ce98d2997e84 upstream. + +The vma length in dup_mmap is calculated and stored in a unsigned int, +which is insufficient and hence overflows for very large maps (beyond +16TB). The following program demonstrates this: + +#include +#include +#include + +#define GIG 1024 * 1024 * 1024L +#define EXTENT 16393 + +int main(void) +{ + int i, r; + void *m; + char buf[1024]; + + for (i = 0; i < EXTENT; i++) { + m = mmap(NULL, (size_t) 1 * 1024 * 1024 * 1024L, + PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, 0, 0); + + if (m == (void *)-1) + printf("MMAP Failed: %d\n", m); + else + printf("%d : MMAP returned %p\n", i, m); + + r = fork(); + + if (r == 0) { + printf("%d: successed\n", i); + return 0; + } else if (r < 0) + printf("FORK Failed: %d\n", r); + else if (r > 0) + wait(NULL); + } + return 0; +} + +Increase the storage size of the result to unsigned long, which is +sufficient for storing the difference between addresses. + +Signed-off-by: Siddhesh Poyarekar +Cc: Tejun Heo +Cc: Oleg Nesterov +Cc: Jens Axboe +Cc: Peter Zijlstra +Acked-by: Hugh Dickins +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + kernel/fork.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +--- a/kernel/fork.c ++++ b/kernel/fork.c +@@ -356,7 +356,8 @@ static int dup_mmap(struct mm_struct *mm + } + charge = 0; + if (mpnt->vm_flags & VM_ACCOUNT) { +- unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; ++ unsigned long len; ++ len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; + if (security_vm_enough_memory_mm(oldmm, len)) /* sic */ + goto fail_nomem; + charge = len; diff --git a/queue-3.4/scsi-fix-dm-multipath-starvation-when-scsi-host-is-busy.patch b/queue-3.4/scsi-fix-dm-multipath-starvation-when-scsi-host-is-busy.patch new file mode 100644 index 00000000000..953969a6ec6 --- /dev/null +++ b/queue-3.4/scsi-fix-dm-multipath-starvation-when-scsi-host-is-busy.patch @@ -0,0 +1,59 @@ +From b7e94a1686c5daef4f649f7f4f839cc294f07710 Mon Sep 17 00:00:00 2001 +From: Jun'ichi Nomura +Date: Tue, 22 May 2012 18:57:17 +0900 +Subject: SCSI: Fix dm-multipath starvation when scsi host is busy + +From: Jun'ichi Nomura + +commit b7e94a1686c5daef4f649f7f4f839cc294f07710 upstream. + +block congestion control doesn't have any concept of fairness across +multiple queues. This means that if SCSI reports the host as busy in +the queue congestion control it can result in an unfair starvation +situation in dm-mp if there are multiple multipath devices on the same +host. For example: +http://www.redhat.com/archives/dm-devel/2012-May/msg00123.html + +The fix for this is to report only the sdev busy state (and ignore the +host busy state) in the block congestion control call back. +The host is still congested, but the SCSI subsystem will sort out the +congestion in a fair way because it knows the relation between the +queues and the host. + +[jejb: fixed up trailing whitespace] +Reported-by: Bernd Schubert +Tested-by: Bernd Schubert +Signed-off-by: Jun'ichi Nomura +Signed-off-by: James Bottomley +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/scsi_lib.c | 11 +++++++---- + 1 file changed, 7 insertions(+), 4 deletions(-) + +--- a/drivers/scsi/scsi_lib.c ++++ b/drivers/scsi/scsi_lib.c +@@ -1378,16 +1378,19 @@ static int scsi_lld_busy(struct request_ + { + struct scsi_device *sdev = q->queuedata; + struct Scsi_Host *shost; +- struct scsi_target *starget; + + if (!sdev) + return 0; + + shost = sdev->host; +- starget = scsi_target(sdev); + +- if (scsi_host_in_recovery(shost) || scsi_host_is_busy(shost) || +- scsi_target_is_busy(starget) || scsi_device_is_busy(sdev)) ++ /* ++ * Ignore host/starget busy state. ++ * Since block layer does not have a concept of fairness across ++ * multiple queues, congestion of host/starget needs to be handled ++ * in SCSI layer. ++ */ ++ if (scsi_host_in_recovery(shost) || scsi_device_is_busy(sdev)) + return 1; + + return 0; diff --git a/queue-3.4/scsi-fix-scsi_wait_scan.patch b/queue-3.4/scsi-fix-scsi_wait_scan.patch new file mode 100644 index 00000000000..b3b8d1ea862 --- /dev/null +++ b/queue-3.4/scsi-fix-scsi_wait_scan.patch @@ -0,0 +1,42 @@ +From 1ff2f40305772b159a91c19590ee159d3a504afc Mon Sep 17 00:00:00 2001 +From: James Bottomley +Date: Wed, 30 May 2012 09:45:39 +0000 +Subject: SCSI: fix scsi_wait_scan + +From: James Bottomley + +commit 1ff2f40305772b159a91c19590ee159d3a504afc upstream. + +Commit c751085943362143f84346d274e0011419c84202 +Author: Rafael J. Wysocki +Date: Sun Apr 12 20:06:56 2009 +0200 + + PM/Hibernate: Wait for SCSI devices scan to complete during resume + +Broke the scsi_wait_scan module in 2.6.30. Apparently debian still uses it so +fix it and backport to stable before removing it in 3.6. + +The breakage is caused because the function template in +include/scsi/scsi_scan.h is defined to be a nop unless SCSI is built in. +That means that in the modular case (which is every distro), the +scsi_wait_scan module does a simple async_synchronize_full() instead of +waiting for scans. + +Signed-off-by: James Bottomley +Signed-off-by: Greg Kroah-Hartman + +--- + drivers/scsi/scsi_wait_scan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/drivers/scsi/scsi_wait_scan.c ++++ b/drivers/scsi/scsi_wait_scan.c +@@ -12,7 +12,7 @@ + + #include + #include +-#include ++#include "scsi_priv.h" + + static int __init wait_scan_init(void) + { diff --git a/queue-3.4/series b/queue-3.4/series new file mode 100644 index 00000000000..4a966e458e9 --- /dev/null +++ b/queue-3.4/series @@ -0,0 +1,7 @@ +exofs-fix-crash-on-very-early-io-errors.patch +microblaze-do-not-select-generic_gpio-by-default.patch +scsi-fix-scsi_wait_scan.patch +scsi-fix-dm-multipath-starvation-when-scsi-host-is-busy.patch +mm-fork-fix-overflow-in-vma-length-when-copying-mmap-on-clone.patch +mm-fix-null-ptr-deref-when-walking-hugepages.patch +mm-consider-all-swapped-back-pages-in-used-once-logic.patch