From: Greg Kroah-Hartman Date: Mon, 29 Mar 2010 18:28:08 +0000 (-0700) Subject: .27 patches X-Git-Tag: v2.6.27.46~35 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=674b3bd73ca967701c0a6e4bd44706e487275cf9;p=thirdparty%2Fkernel%2Fstable-queue.git .27 patches --- diff --git a/queue-2.6.27/doc-add-the-documentation-for-mpol-local.patch b/queue-2.6.27/doc-add-the-documentation-for-mpol-local.patch new file mode 100644 index 00000000000..3554fa12ee9 --- /dev/null +++ b/queue-2.6.27/doc-add-the-documentation-for-mpol-local.patch @@ -0,0 +1,51 @@ +From 5574169613b40b85d6f4c67208fa4846b897a0a1 Mon Sep 17 00:00:00 2001 +From: KOSAKI Motohiro +Date: Tue, 23 Mar 2010 13:35:33 -0700 +Subject: doc: add the documentation for mpol=local + +From: KOSAKI Motohiro + +commit 5574169613b40b85d6f4c67208fa4846b897a0a1 upstream. + +commit 3f226aa1c (mempolicy: support mpol=local tmpfs mount option) added +new mpol=local mount option. but it didn't add a documentation. + +This patch does it. + +Signed-off-by: KOSAKI Motohiro +Cc: Ravikiran Thirumalai +Cc: Christoph Lameter +Cc: Mel Gorman +Acked-by: Lee Schermerhorn +Cc: Hugh Dickins +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + Documentation/filesystems/tmpfs.txt | 6 +++++- + 1 file changed, 5 insertions(+), 1 deletion(-) + +--- a/Documentation/filesystems/tmpfs.txt ++++ b/Documentation/filesystems/tmpfs.txt +@@ -82,11 +82,13 @@ tmpfs has a mount option to set the NUMA + all files in that instance (if CONFIG_NUMA is enabled) - which can be + adjusted on the fly via 'mount -o remount ...' + +-mpol=default prefers to allocate memory from the local node ++mpol=default use the process allocation policy ++ (see set_mempolicy(2)) + mpol=prefer:Node prefers to allocate memory from the given Node + mpol=bind:NodeList allocates memory only from nodes in NodeList + mpol=interleave prefers to allocate from each node in turn + mpol=interleave:NodeList allocates from each node of NodeList in turn ++mpol=local prefers to allocate memory from the local node + + NodeList format is a comma-separated list of decimal numbers and ranges, + a range being two hyphen-separated decimal numbers, the smallest and +@@ -134,3 +136,5 @@ Author: + Christoph Rohland , 1.12.01 + Updated: + Hugh Dickins , 4 June 2007 ++Updated: ++ KOSAKI Motohiro, 16 Mar 2010 diff --git a/queue-2.6.27/series b/queue-2.6.27/series index 2c8ab912c4e..736dc1dd853 100644 --- a/queue-2.6.27/series +++ b/queue-2.6.27/series @@ -37,3 +37,8 @@ bonding-ignore-updelay-param-when-there-is-no-active-slave.patch v4l-dvb-13961-em28xx-dvb-fix-memleak-in-dvb_fini.patch aoe-end-barrier-bios-with-eopnotsupp.patch b44-wol-setup-one-bit-off-stack-corruption-kernel-panic-fix.patch +tmpfs-fix-oops-on-mounts-with-mpol-default.patch +tmpfs-mpol-bind-0-don-t-cause-mount-error.patch +tmpfs-handle-mpol_local-mount-option-properly.patch +doc-add-the-documentation-for-mpol-local.patch +tmpfs-cleanup-mpol_parse_str.patch diff --git a/queue-2.6.27/tmpfs-cleanup-mpol_parse_str.patch b/queue-2.6.27/tmpfs-cleanup-mpol_parse_str.patch new file mode 100644 index 00000000000..1d31bb65e59 --- /dev/null +++ b/queue-2.6.27/tmpfs-cleanup-mpol_parse_str.patch @@ -0,0 +1,99 @@ +From 926f2ae04f183098cf9a30521776fb2759c8afeb Mon Sep 17 00:00:00 2001 +From: KOSAKI Motohiro +Date: Tue, 23 Mar 2010 13:35:32 -0700 +Subject: tmpfs: cleanup mpol_parse_str() + +From: KOSAKI Motohiro + +commit 926f2ae04f183098cf9a30521776fb2759c8afeb upstream. + +mpol_parse_str() made lots 'err' variable related bug. Because it is ugly +and reviewing unfriendly. + +This patch simplifies it. + +Signed-off-by: KOSAKI Motohiro +Cc: Ravikiran Thirumalai +Cc: Christoph Lameter +Cc: Mel Gorman +Acked-by: Lee Schermerhorn +Cc: Hugh Dickins +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2195,8 +2195,8 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + char *rest = nodelist; + while (isdigit(*rest)) + rest++; +- if (!*rest) +- err = 0; ++ if (*rest) ++ goto out; + } + break; + case MPOL_INTERLEAVE: +@@ -2205,7 +2205,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + */ + if (!nodelist) + nodes = node_states[N_HIGH_MEMORY]; +- err = 0; + break; + case MPOL_LOCAL: + /* +@@ -2214,7 +2213,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + if (nodelist) + goto out; + mode = MPOL_PREFERRED; +- err = 0; + break; + case MPOL_DEFAULT: + /* +@@ -2229,7 +2227,6 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + */ + if (!nodelist) + goto out; +- err = 0; + } + + mode_flags = 0; +@@ -2243,13 +2240,14 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + else if (!strcmp(flags, "relative")) + mode_flags |= MPOL_F_RELATIVE_NODES; + else +- err = 1; ++ goto out; + } + + new = mpol_new(mode, mode_flags, &nodes); + if (IS_ERR(new)) +- err = 1; +- else { ++ goto out; ++ ++ { + int ret; + NODEMASK_SCRATCH(scratch); + if (scratch) { +@@ -2260,13 +2258,15 @@ int mpol_parse_str(char *str, struct mempolicy **mpol, int no_context) + ret = -ENOMEM; + NODEMASK_SCRATCH_FREE(scratch); + if (ret) { +- err = 1; + mpol_put(new); +- } else if (no_context) { +- /* save for contextualization */ +- new->w.user_nodemask = nodes; ++ goto out; + } + } ++ err = 0; ++ if (no_context) { ++ /* save for contextualization */ ++ new->w.user_nodemask = nodes; ++ } + + out: + /* Restore string for error message */ diff --git a/queue-2.6.27/tmpfs-fix-oops-on-mounts-with-mpol-default.patch b/queue-2.6.27/tmpfs-fix-oops-on-mounts-with-mpol-default.patch new file mode 100644 index 00000000000..e7cb8d5998b --- /dev/null +++ b/queue-2.6.27/tmpfs-fix-oops-on-mounts-with-mpol-default.patch @@ -0,0 +1,55 @@ +From 413b43deab8377819aba1dbad2abf0c15d59b491 Mon Sep 17 00:00:00 2001 +From: Ravikiran G Thirumalai +Date: Tue, 23 Mar 2010 13:35:28 -0700 +Subject: tmpfs: fix oops on mounts with mpol=default + +From: Ravikiran G Thirumalai + +commit 413b43deab8377819aba1dbad2abf0c15d59b491 upstream. + +Fix an 'oops' when a tmpfs mount point is mounted with the mpol=default +mempolicy. + +Upon remounting a tmpfs mount point with 'mpol=default' option, the mount +code crashed with a null pointer dereference. The initial problem report +was on 2.6.27, but the problem exists in mainline 2.6.34-rc as well. On +examining the code, we see that mpol_new returns NULL if default mempolicy +was requested. This 'NULL' mempolicy is accessed to store the node mask +resulting in oops. + +The following patch fixes it. + +Signed-off-by: Ravikiran Thirumalai +Signed-off-by: KOSAKI Motohiro +Cc: Christoph Lameter +Cc: Mel Gorman +Acked-by: Lee Schermerhorn +Cc: Hugh Dickins +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/mempolicy.c | 9 +++++++-- + 1 file changed, 7 insertions(+), 2 deletions(-) + +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2049,10 +2049,15 @@ int mpol_parse_str(char *str, struct mem + goto out; + mode = MPOL_PREFERRED; + break; +- ++ case MPOL_DEFAULT: ++ /* ++ * Insist on a empty nodelist ++ */ ++ if (!nodelist) ++ err = 0; ++ goto out; + /* + * case MPOL_BIND: mpol_new() enforces non-empty nodemask. +- * case MPOL_DEFAULT: mpol_new() enforces empty nodemask, ignores flags. + */ + } + diff --git a/queue-2.6.27/tmpfs-handle-mpol_local-mount-option-properly.patch b/queue-2.6.27/tmpfs-handle-mpol_local-mount-option-properly.patch new file mode 100644 index 00000000000..6eecf266946 --- /dev/null +++ b/queue-2.6.27/tmpfs-handle-mpol_local-mount-option-properly.patch @@ -0,0 +1,40 @@ +From 12821f5fb942e795f8009ece14bde868893bd811 Mon Sep 17 00:00:00 2001 +From: KOSAKI Motohiro +Date: Tue, 23 Mar 2010 13:35:31 -0700 +Subject: tmpfs: handle MPOL_LOCAL mount option properly + +From: KOSAKI Motohiro + +commit 12821f5fb942e795f8009ece14bde868893bd811 upstream. + +commit 71fe804b6d5 (mempolicy: use struct mempolicy pointer in +shmem_sb_info) added mpol=local mount option. but its feature is broken +since it was born. because such code always return 1 (i.e. mount +failure). + +This patch fixes it. + +Signed-off-by: KOSAKI Motohiro +Cc: Ravikiran Thirumalai +Cc: Christoph Lameter +Cc: Mel Gorman +Acked-by: Lee Schermerhorn +Cc: Hugh Dickins +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/mempolicy.c | 1 + + 1 file changed, 1 insertion(+) + +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2048,6 +2048,7 @@ int mpol_parse_str(char *str, struct mem + if (nodelist) + goto out; + mode = MPOL_PREFERRED; ++ err = 0; + break; + case MPOL_DEFAULT: + /* diff --git a/queue-2.6.27/tmpfs-mpol-bind-0-don-t-cause-mount-error.patch b/queue-2.6.27/tmpfs-mpol-bind-0-don-t-cause-mount-error.patch new file mode 100644 index 00000000000..d487029a10c --- /dev/null +++ b/queue-2.6.27/tmpfs-mpol-bind-0-don-t-cause-mount-error.patch @@ -0,0 +1,51 @@ +From d69b2e63e9172afb4d07c305601b79a55509ac4c Mon Sep 17 00:00:00 2001 +From: KOSAKI Motohiro +Date: Tue, 23 Mar 2010 13:35:30 -0700 +Subject: tmpfs: mpol=bind:0 don't cause mount error. + +From: KOSAKI Motohiro + +commit d69b2e63e9172afb4d07c305601b79a55509ac4c upstream. + +Currently, following mount operation cause mount error. + +% mount -t tmpfs -ompol=bind:0 none /tmp + +Because commit 71fe804b6d5 (mempolicy: use struct mempolicy pointer in +shmem_sb_info) corrupted MPOL_BIND parse code. + +This patch restore the needed one. + +Signed-off-by: KOSAKI Motohiro +Cc: Ravikiran Thirumalai +Cc: Christoph Lameter +Cc: Mel Gorman +Acked-by: Lee Schermerhorn +Cc: Hugh Dickins +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/mempolicy.c | 10 +++++++--- + 1 file changed, 7 insertions(+), 3 deletions(-) + +--- a/mm/mempolicy.c ++++ b/mm/mempolicy.c +@@ -2056,9 +2056,13 @@ int mpol_parse_str(char *str, struct mem + if (!nodelist) + err = 0; + goto out; +- /* +- * case MPOL_BIND: mpol_new() enforces non-empty nodemask. +- */ ++ case MPOL_BIND: ++ /* ++ * Insist on a nodelist ++ */ ++ if (!nodelist) ++ goto out; ++ err = 0; + } + + mode_flags = 0;