From: Greg Kroah-Hartman Date: Thu, 20 Feb 2014 21:25:31 +0000 (-0800) Subject: 3.13-stable patches X-Git-Tag: v3.4.82~39 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=22d5e046c897535f001745fb2e1a144d073aa937;p=thirdparty%2Fkernel%2Fstable-queue.git 3.13-stable patches added patches: add-protocol-specific-operation-for-cifs-xattrs.patch arm-pxa-fix-various-compilation-problems.patch cifs-fix-smb2-mounts-so-they-don-t-try-to-set-or-get-xattrs-via-cifs.patch fs-file.c-fdtable-avoid-triggering-ooms-from-alloc_fdmem.patch mm-fix-page-leak-at-nfs_symlink.patch mm-memory-failure.c-move-refcount-only-in-mf_count_increased.patch retrieving-cifs-acls-when-mounted-with-smb2-fails-dropping-session.patch --- diff --git a/queue-3.13/add-protocol-specific-operation-for-cifs-xattrs.patch b/queue-3.13/add-protocol-specific-operation-for-cifs-xattrs.patch new file mode 100644 index 00000000000..26e7891e469 --- /dev/null +++ b/queue-3.13/add-protocol-specific-operation-for-cifs-xattrs.patch @@ -0,0 +1,67 @@ +From d979f3b0a1f0b5499ab85e68cdf02b56852918b6 Mon Sep 17 00:00:00 2001 +From: Steve French +Date: Sat, 1 Feb 2014 23:27:18 -0600 +Subject: Add protocol specific operation for CIFS xattrs + +From: Steve French + +commit d979f3b0a1f0b5499ab85e68cdf02b56852918b6 upstream. + +Changeset 666753c3ef8fc88b0ddd5be4865d0aa66428ac35 added protocol +operations for get/setxattr to avoid calling cifs operations +on smb2/smb3 mounts for xattr operations and this changeset +adds the calls to cifs specific protocol operations for xattrs +(in order to reenable cifs support for xattrs which was +temporarily disabled by the previous changeset. We do not +have SMB2/SMB3 worker function for setting xattrs yet so +this only enables it for cifs. + +CCing stable since without these two small changsets (its +small coreq 666753c3ef8fc88b0ddd5be4865d0aa66428ac35 is +also needed) calling getfattr/setfattr on smb2/smb3 mounts +causes problems. + +Signed-off-by: Steve French +Reviewed-by: Shirish Pargaonkar +Signed-off-by: Greg Kroah-Hartman + +--- + fs/cifs/inode.c | 13 +++++++++---- + fs/cifs/smb1ops.c | 4 ++++ + 2 files changed, 13 insertions(+), 4 deletions(-) + +--- a/fs/cifs/inode.c ++++ b/fs/cifs/inode.c +@@ -518,10 +518,15 @@ static int cifs_sfu_mode(struct cifs_fat + return PTR_ERR(tlink); + tcon = tlink_tcon(tlink); + +- rc = CIFSSMBQAllEAs(xid, tcon, path, "SETFILEBITS", +- ea_value, 4 /* size of buf */, cifs_sb->local_nls, +- cifs_sb->mnt_cifs_flags & +- CIFS_MOUNT_MAP_SPECIAL_CHR); ++ if (tcon->ses->server->ops->query_all_EAs == NULL) { ++ cifs_put_tlink(tlink); ++ return -EOPNOTSUPP; ++ } ++ ++ rc = tcon->ses->server->ops->query_all_EAs(xid, tcon, path, ++ "SETFILEBITS", ea_value, 4 /* size of buf */, ++ cifs_sb->local_nls, ++ cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); + cifs_put_tlink(tlink); + if (rc < 0) + return (int)rc; +--- a/fs/cifs/smb1ops.c ++++ b/fs/cifs/smb1ops.c +@@ -1011,6 +1011,10 @@ struct smb_version_operations smb1_opera + .push_mand_locks = cifs_push_mandatory_locks, + .query_mf_symlink = open_query_close_cifs_symlink, + .is_read_op = cifs_is_read_op, ++#ifdef CONFIG_CIFS_XATTR ++ .query_all_EAs = CIFSSMBQAllEAs, ++ .set_EA = CIFSSMBSetEA, ++#endif /* CIFS_XATTR */ + }; + + struct smb_version_values smb1_values = { diff --git a/queue-3.13/arm-pxa-fix-various-compilation-problems.patch b/queue-3.13/arm-pxa-fix-various-compilation-problems.patch new file mode 100644 index 00000000000..bfd8bfdf9e2 --- /dev/null +++ b/queue-3.13/arm-pxa-fix-various-compilation-problems.patch @@ -0,0 +1,215 @@ +From 9705e74671f0e4f994d86b00cecf441917c64a66 Mon Sep 17 00:00:00 2001 +From: Linus Walleij +Date: Tue, 4 Feb 2014 13:53:07 +0100 +Subject: ARM: pxa: fix various compilation problems +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +From: Linus Walleij + +commit 9705e74671f0e4f994d86b00cecf441917c64a66 upstream. + +Due to commit 88f718e3fa4d67f3a8dbe79a2f97d722323e4051 +"ARM: pxa: delete the custom GPIO header" some drivers fail +compilation, for example like this: + +In file included from sound/soc/pxa/spitz.c:28:0: +sound/soc/pxa/spitz.c: In function ‘spitz_ext_control’: +arch/arm/mach-pxa/include/mach/spitz.h:111:30: error: +‘PXA_NR_BUILTIN_GPIO’ undeclared (first use in this function) + #define SPITZ_SCP_GPIO_BASE (PXA_NR_BUILTIN_GPIO) +(etc.) + +This is caused by implicit inclusion of from +various board-specific headers under in the PXA +platform. So we take a sweep over these, and for every such +header that uses PXA_NR_BUILTIN_GPIO or PXA_GPIO_TO_IRQ() +we explicitly #include "irqs.h" so that we satisfy the +dependency in the board include file alone. + +Reported-by: Arnd Bergmann +Signed-off-by: Linus Walleij +Signed-off-by: Kevin Hilman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/arm/mach-pxa/include/mach/balloon3.h | 2 ++ + arch/arm/mach-pxa/include/mach/corgi.h | 1 + + arch/arm/mach-pxa/include/mach/csb726.h | 2 ++ + arch/arm/mach-pxa/include/mach/gumstix.h | 1 + + arch/arm/mach-pxa/include/mach/idp.h | 1 + + arch/arm/mach-pxa/include/mach/palmld.h | 2 ++ + arch/arm/mach-pxa/include/mach/palmt5.h | 2 ++ + arch/arm/mach-pxa/include/mach/palmtc.h | 2 ++ + arch/arm/mach-pxa/include/mach/palmtx.h | 2 ++ + arch/arm/mach-pxa/include/mach/pcm027.h | 2 ++ + arch/arm/mach-pxa/include/mach/pcm990_baseboard.h | 1 + + arch/arm/mach-pxa/include/mach/poodle.h | 2 ++ + arch/arm/mach-pxa/include/mach/spitz.h | 2 +- + arch/arm/mach-pxa/include/mach/tosa.h | 2 ++ + arch/arm/mach-pxa/include/mach/trizeps4.h | 2 ++ + 15 files changed, 25 insertions(+), 1 deletion(-) + +--- a/arch/arm/mach-pxa/include/mach/balloon3.h ++++ b/arch/arm/mach-pxa/include/mach/balloon3.h +@@ -14,6 +14,8 @@ + #ifndef ASM_ARCH_BALLOON3_H + #define ASM_ARCH_BALLOON3_H + ++#include "irqs.h" /* PXA_NR_BUILTIN_GPIO */ ++ + enum balloon3_features { + BALLOON3_FEATURE_OHCI, + BALLOON3_FEATURE_MMC, +--- a/arch/arm/mach-pxa/include/mach/corgi.h ++++ b/arch/arm/mach-pxa/include/mach/corgi.h +@@ -13,6 +13,7 @@ + #ifndef __ASM_ARCH_CORGI_H + #define __ASM_ARCH_CORGI_H 1 + ++#include "irqs.h" /* PXA_NR_BUILTIN_GPIO */ + + /* + * Corgi (Non Standard) GPIO Definitions +--- a/arch/arm/mach-pxa/include/mach/csb726.h ++++ b/arch/arm/mach-pxa/include/mach/csb726.h +@@ -11,6 +11,8 @@ + #ifndef CSB726_H + #define CSB726_H + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ ++ + #define CSB726_GPIO_IRQ_LAN 52 + #define CSB726_GPIO_IRQ_SM501 53 + #define CSB726_GPIO_MMC_DETECT 100 +--- a/arch/arm/mach-pxa/include/mach/gumstix.h ++++ b/arch/arm/mach-pxa/include/mach/gumstix.h +@@ -6,6 +6,7 @@ + * published by the Free Software Foundation. + */ + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ + + /* BTRESET - Reset line to Bluetooth module, active low signal. */ + #define GPIO_GUMSTIX_BTRESET 7 +--- a/arch/arm/mach-pxa/include/mach/idp.h ++++ b/arch/arm/mach-pxa/include/mach/idp.h +@@ -23,6 +23,7 @@ + * IDP hardware. + */ + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ + + #define IDP_FLASH_PHYS (PXA_CS0_PHYS) + #define IDP_ALT_FLASH_PHYS (PXA_CS1_PHYS) +--- a/arch/arm/mach-pxa/include/mach/palmld.h ++++ b/arch/arm/mach-pxa/include/mach/palmld.h +@@ -13,6 +13,8 @@ + #ifndef _INCLUDE_PALMLD_H_ + #define _INCLUDE_PALMLD_H_ + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ ++ + /** HERE ARE GPIOs **/ + + /* GPIOs */ +--- a/arch/arm/mach-pxa/include/mach/palmt5.h ++++ b/arch/arm/mach-pxa/include/mach/palmt5.h +@@ -15,6 +15,8 @@ + #ifndef _INCLUDE_PALMT5_H_ + #define _INCLUDE_PALMT5_H_ + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ ++ + /** HERE ARE GPIOs **/ + + /* GPIOs */ +--- a/arch/arm/mach-pxa/include/mach/palmtc.h ++++ b/arch/arm/mach-pxa/include/mach/palmtc.h +@@ -16,6 +16,8 @@ + #ifndef _INCLUDE_PALMTC_H_ + #define _INCLUDE_PALMTC_H_ + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ ++ + /** HERE ARE GPIOs **/ + + /* GPIOs */ +--- a/arch/arm/mach-pxa/include/mach/palmtx.h ++++ b/arch/arm/mach-pxa/include/mach/palmtx.h +@@ -16,6 +16,8 @@ + #ifndef _INCLUDE_PALMTX_H_ + #define _INCLUDE_PALMTX_H_ + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ ++ + /** HERE ARE GPIOs **/ + + /* GPIOs */ +--- a/arch/arm/mach-pxa/include/mach/pcm027.h ++++ b/arch/arm/mach-pxa/include/mach/pcm027.h +@@ -23,6 +23,8 @@ + * Definitions of CPU card resources only + */ + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ ++ + /* phyCORE-PXA270 (PCM027) Interrupts */ + #define PCM027_IRQ(x) (IRQ_BOARD_START + (x)) + #define PCM027_BTDET_IRQ PCM027_IRQ(0) +--- a/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h ++++ b/arch/arm/mach-pxa/include/mach/pcm990_baseboard.h +@@ -20,6 +20,7 @@ + */ + + #include ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ + + /* + * definitions relevant only when the PCM-990 +--- a/arch/arm/mach-pxa/include/mach/poodle.h ++++ b/arch/arm/mach-pxa/include/mach/poodle.h +@@ -15,6 +15,8 @@ + #ifndef __ASM_ARCH_POODLE_H + #define __ASM_ARCH_POODLE_H 1 + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ ++ + /* + * GPIOs + */ +--- a/arch/arm/mach-pxa/include/mach/spitz.h ++++ b/arch/arm/mach-pxa/include/mach/spitz.h +@@ -15,8 +15,8 @@ + #define __ASM_ARCH_SPITZ_H 1 + #endif + ++#include "irqs.h" /* PXA_NR_BUILTIN_GPIO, PXA_GPIO_TO_IRQ */ + #include +-#include + + /* Spitz/Akita GPIOs */ + +--- a/arch/arm/mach-pxa/include/mach/tosa.h ++++ b/arch/arm/mach-pxa/include/mach/tosa.h +@@ -13,6 +13,8 @@ + #ifndef _ASM_ARCH_TOSA_H_ + #define _ASM_ARCH_TOSA_H_ 1 + ++#include "irqs.h" /* PXA_NR_BUILTIN_GPIO */ ++ + /* TOSA Chip selects */ + #define TOSA_LCDC_PHYS PXA_CS4_PHYS + /* Internel Scoop */ +--- a/arch/arm/mach-pxa/include/mach/trizeps4.h ++++ b/arch/arm/mach-pxa/include/mach/trizeps4.h +@@ -10,6 +10,8 @@ + #ifndef _TRIPEPS4_H_ + #define _TRIPEPS4_H_ + ++#include "irqs.h" /* PXA_GPIO_TO_IRQ */ ++ + /* physical memory regions */ + #define TRIZEPS4_FLASH_PHYS (PXA_CS0_PHYS) /* Flash region */ + #define TRIZEPS4_DISK_PHYS (PXA_CS1_PHYS) /* Disk On Chip region */ diff --git a/queue-3.13/cifs-fix-smb2-mounts-so-they-don-t-try-to-set-or-get-xattrs-via-cifs.patch b/queue-3.13/cifs-fix-smb2-mounts-so-they-don-t-try-to-set-or-get-xattrs-via-cifs.patch new file mode 100644 index 00000000000..83b19f3aac3 --- /dev/null +++ b/queue-3.13/cifs-fix-smb2-mounts-so-they-don-t-try-to-set-or-get-xattrs-via-cifs.patch @@ -0,0 +1,130 @@ +From 666753c3ef8fc88b0ddd5be4865d0aa66428ac35 Mon Sep 17 00:00:00 2001 +From: Steve French +Date: Sun, 26 Jan 2014 23:53:43 -0600 +Subject: CIFS: Fix SMB2 mounts so they don't try to set or get xattrs via cifs + +From: Steve French + +commit 666753c3ef8fc88b0ddd5be4865d0aa66428ac35 upstream. + +When mounting with smb2 (or smb2.1 or smb3) we need to check to make +sure that attempts to query or set extended attributes do not +attempt to send the request with the older cifs protocol instead +(eventually we also need to add the support in SMB2 +to query/set extended attributes but this patch prevents us from +using the wrong protocol for extended attribute operations). + +Signed-off-by: Steve French +Signed-off-by: Greg Kroah-Hartman + +--- + fs/cifs/cifsglob.h | 6 ++++++ + fs/cifs/xattr.c | 49 ++++++++++++++++++++++++++++++------------------- + 2 files changed, 36 insertions(+), 19 deletions(-) + +--- a/fs/cifs/cifsglob.h ++++ b/fs/cifs/cifsglob.h +@@ -385,6 +385,12 @@ struct smb_version_operations { + struct cifsFileInfo *target_file, u64 src_off, u64 len, + u64 dest_off); + int (*validate_negotiate)(const unsigned int, struct cifs_tcon *); ++ ssize_t (*query_all_EAs)(const unsigned int, struct cifs_tcon *, ++ const unsigned char *, const unsigned char *, char *, ++ size_t, const struct nls_table *, int); ++ int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *, ++ const char *, const void *, const __u16, ++ const struct nls_table *, int); + }; + + struct smb_version_values { +--- a/fs/cifs/xattr.c ++++ b/fs/cifs/xattr.c +@@ -82,9 +82,11 @@ int cifs_removexattr(struct dentry *dire + goto remove_ea_exit; + + ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ +- rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, NULL, +- (__u16)0, cifs_sb->local_nls, +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); ++ if (pTcon->ses->server->ops->set_EA) ++ rc = pTcon->ses->server->ops->set_EA(xid, pTcon, ++ full_path, ea_name, NULL, (__u16)0, ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & ++ CIFS_MOUNT_MAP_SPECIAL_CHR); + } + remove_ea_exit: + kfree(full_path); +@@ -149,18 +151,22 @@ int cifs_setxattr(struct dentry *direntr + cifs_dbg(FYI, "attempt to set cifs inode metadata\n"); + + ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ +- rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, +- (__u16)value_size, cifs_sb->local_nls, +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); ++ if (pTcon->ses->server->ops->set_EA) ++ rc = pTcon->ses->server->ops->set_EA(xid, pTcon, ++ full_path, ea_name, ea_value, (__u16)value_size, ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & ++ CIFS_MOUNT_MAP_SPECIAL_CHR); + } else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) + == 0) { + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) + goto set_ea_exit; + + ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */ +- rc = CIFSSMBSetEA(xid, pTcon, full_path, ea_name, ea_value, +- (__u16)value_size, cifs_sb->local_nls, +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); ++ if (pTcon->ses->server->ops->set_EA) ++ rc = pTcon->ses->server->ops->set_EA(xid, pTcon, ++ full_path, ea_name, ea_value, (__u16)value_size, ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & ++ CIFS_MOUNT_MAP_SPECIAL_CHR); + } else if (strncmp(ea_name, CIFS_XATTR_CIFS_ACL, + strlen(CIFS_XATTR_CIFS_ACL)) == 0) { + #ifdef CONFIG_CIFS_ACL +@@ -272,17 +278,21 @@ ssize_t cifs_getxattr(struct dentry *dir + /* revalidate/getattr then populate from inode */ + } /* BB add else when above is implemented */ + ea_name += XATTR_USER_PREFIX_LEN; /* skip past user. prefix */ +- rc = CIFSSMBQAllEAs(xid, pTcon, full_path, ea_name, ea_value, +- buf_size, cifs_sb->local_nls, +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); ++ if (pTcon->ses->server->ops->query_all_EAs) ++ rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, ++ full_path, ea_name, ea_value, buf_size, ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & ++ CIFS_MOUNT_MAP_SPECIAL_CHR); + } else if (strncmp(ea_name, XATTR_OS2_PREFIX, XATTR_OS2_PREFIX_LEN) == 0) { + if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_NO_XATTR) + goto get_ea_exit; + + ea_name += XATTR_OS2_PREFIX_LEN; /* skip past os2. prefix */ +- rc = CIFSSMBQAllEAs(xid, pTcon, full_path, ea_name, ea_value, +- buf_size, cifs_sb->local_nls, +- cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MAP_SPECIAL_CHR); ++ if (pTcon->ses->server->ops->query_all_EAs) ++ rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, ++ full_path, ea_name, ea_value, buf_size, ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & ++ CIFS_MOUNT_MAP_SPECIAL_CHR); + } else if (strncmp(ea_name, POSIX_ACL_XATTR_ACCESS, + strlen(POSIX_ACL_XATTR_ACCESS)) == 0) { + #ifdef CONFIG_CIFS_POSIX +@@ -400,11 +410,12 @@ ssize_t cifs_listxattr(struct dentry *di + /* if proc/fs/cifs/streamstoxattr is set then + search server for EAs or streams to + returns as xattrs */ +- rc = CIFSSMBQAllEAs(xid, pTcon, full_path, NULL, data, +- buf_size, cifs_sb->local_nls, +- cifs_sb->mnt_cifs_flags & +- CIFS_MOUNT_MAP_SPECIAL_CHR); + ++ if (pTcon->ses->server->ops->query_all_EAs) ++ rc = pTcon->ses->server->ops->query_all_EAs(xid, pTcon, ++ full_path, NULL, data, buf_size, ++ cifs_sb->local_nls, cifs_sb->mnt_cifs_flags & ++ CIFS_MOUNT_MAP_SPECIAL_CHR); + list_ea_exit: + kfree(full_path); + free_xid(xid); diff --git a/queue-3.13/fs-file.c-fdtable-avoid-triggering-ooms-from-alloc_fdmem.patch b/queue-3.13/fs-file.c-fdtable-avoid-triggering-ooms-from-alloc_fdmem.patch new file mode 100644 index 00000000000..f83a54a3daf --- /dev/null +++ b/queue-3.13/fs-file.c-fdtable-avoid-triggering-ooms-from-alloc_fdmem.patch @@ -0,0 +1,64 @@ +From 96c7a2ff21501691587e1ae969b83cbec8b78e08 Mon Sep 17 00:00:00 2001 +From: "Eric W. Biederman" +Date: Mon, 10 Feb 2014 14:25:41 -0800 +Subject: fs/file.c:fdtable: avoid triggering OOMs from alloc_fdmem + +From: "Eric W. Biederman" + +commit 96c7a2ff21501691587e1ae969b83cbec8b78e08 upstream. + +Recently due to a spike in connections per second memcached on 3 +separate boxes triggered the OOM killer from accept. At the time the +OOM killer was triggered there was 4GB out of 36GB free in zone 1. The +problem was that alloc_fdtable was allocating an order 3 page (32KiB) to +hold a bitmap, and there was sufficient fragmentation that the largest +page available was 8KiB. + +I find the logic that PAGE_ALLOC_COSTLY_ORDER can't fail pretty dubious +but I do agree that order 3 allocations are very likely to succeed. + +There are always pathologies where order > 0 allocations can fail when +there are copious amounts of free memory available. Using the pigeon +hole principle it is easy to show that it requires 1 page more than 50% +of the pages being free to guarantee an order 1 (8KiB) allocation will +succeed, 1 page more than 75% of the pages being free to guarantee an +order 2 (16KiB) allocation will succeed and 1 page more than 87.5% of +the pages being free to guarantee an order 3 allocate will succeed. + +A server churning memory with a lot of small requests and replies like +memcached is a common case that if anything can will skew the odds +against large pages being available. + +Therefore let's not give external applications a practical way to kill +linux server applications, and specify __GFP_NORETRY to the kmalloc in +alloc_fdmem. Unless I am misreading the code and by the time the code +reaches should_alloc_retry in __alloc_pages_slowpath (where +__GFP_NORETRY becomes signification). We have already tried everything +reasonable to allocate a page and the only thing left to do is wait. So +not waiting and falling back to vmalloc immediately seems like the +reasonable thing to do even if there wasn't a chance of triggering the +OOM killer. + +Signed-off-by: "Eric W. Biederman" +Cc: Eric Dumazet +Acked-by: David Rientjes +Cc: Cong Wang +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/file.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/fs/file.c ++++ b/fs/file.c +@@ -34,7 +34,7 @@ static void *alloc_fdmem(size_t size) + * vmalloc() if the allocation size will be considered "large" by the VM. + */ + if (size <= (PAGE_SIZE << PAGE_ALLOC_COSTLY_ORDER)) { +- void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN); ++ void *data = kmalloc(size, GFP_KERNEL|__GFP_NOWARN|__GFP_NORETRY); + if (data != NULL) + return data; + } diff --git a/queue-3.13/mm-fix-page-leak-at-nfs_symlink.patch b/queue-3.13/mm-fix-page-leak-at-nfs_symlink.patch new file mode 100644 index 00000000000..fa00321b067 --- /dev/null +++ b/queue-3.13/mm-fix-page-leak-at-nfs_symlink.patch @@ -0,0 +1,50 @@ +From a0b54adda3fe4b4cc6d28f2a9217cd35d1aa888c Mon Sep 17 00:00:00 2001 +From: Rafael Aquini +Date: Mon, 10 Feb 2014 14:25:48 -0800 +Subject: mm: fix page leak at nfs_symlink() + +From: Rafael Aquini + +commit a0b54adda3fe4b4cc6d28f2a9217cd35d1aa888c upstream. + +Changes in commit a0b8cab3b9b2 ("mm: remove lru parameter from +__pagevec_lru_add and remove parts of pagevec API") have introduced a +call to add_to_page_cache_lru() which causes a leak in nfs_symlink() as +now the page gets an extra refcount that is not dropped. + +Jan Stancek observed and reported the leak effect while running test8 +from Connectathon Testsuite. After several iterations over the test +case, which creates several symlinks on a NFS mountpoint, the test +system was quickly getting into an out-of-memory scenario. + +This patch fixes the page leak by dropping that extra refcount +add_to_page_cache_lru() is grabbing. + +Signed-off-by: Jan Stancek +Signed-off-by: Rafael Aquini +Acked-by: Mel Gorman +Acked-by: Rik van Riel +Cc: Jeff Layton +Cc: Trond Myklebust +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + fs/nfs/dir.c | 5 +++++ + 1 file changed, 5 insertions(+) + +--- a/fs/nfs/dir.c ++++ b/fs/nfs/dir.c +@@ -1837,6 +1837,11 @@ int nfs_symlink(struct inode *dir, struc + GFP_KERNEL)) { + SetPageUptodate(page); + unlock_page(page); ++ /* ++ * add_to_page_cache_lru() grabs an extra page refcount. ++ * Drop it here to avoid leaking this page later. ++ */ ++ page_cache_release(page); + } else + __free_page(page); + diff --git a/queue-3.13/mm-memory-failure.c-move-refcount-only-in-mf_count_increased.patch b/queue-3.13/mm-memory-failure.c-move-refcount-only-in-mf_count_increased.patch new file mode 100644 index 00000000000..7d773c1ba15 --- /dev/null +++ b/queue-3.13/mm-memory-failure.c-move-refcount-only-in-mf_count_increased.patch @@ -0,0 +1,51 @@ +From 8d547ff4ac5927245e0833ac18528f939da0ee0e Mon Sep 17 00:00:00 2001 +From: Naoya Horiguchi +Date: Mon, 10 Feb 2014 14:25:50 -0800 +Subject: mm/memory-failure.c: move refcount only in !MF_COUNT_INCREASED + +From: Naoya Horiguchi + +commit 8d547ff4ac5927245e0833ac18528f939da0ee0e upstream. + +mce-test detected a test failure when injecting error to a thp tail +page. This is because we take page refcount of the tail page in +madvise_hwpoison() while the fix in commit a3e0f9e47d5e +("mm/memory-failure.c: transfer page count from head page to tail page +after split thp") assumes that we always take refcount on the head page. + +When a real memory error happens we take refcount on the head page where +memory_failure() is called without MF_COUNT_INCREASED set, so it seems +to me that testing memory error on thp tail page using madvise makes +little sense. + +This patch cancels moving refcount in !MF_COUNT_INCREASED for valid +testing. + +[akpm@linux-foundation.org: s/&&/&/] +Signed-off-by: Naoya Horiguchi +Cc: Andi Kleen +Cc: Wanpeng Li +Cc: Chen Gong +Signed-off-by: Andrew Morton +Signed-off-by: Linus Torvalds +Signed-off-by: Greg Kroah-Hartman + +--- + mm/memory-failure.c | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +--- a/mm/memory-failure.c ++++ b/mm/memory-failure.c +@@ -945,8 +945,10 @@ static int hwpoison_user_mappings(struct + * to it. Similarly, page lock is shifted. + */ + if (hpage != p) { +- put_page(hpage); +- get_page(p); ++ if (!(flags & MF_COUNT_INCREASED)) { ++ put_page(hpage); ++ get_page(p); ++ } + lock_page(p); + unlock_page(hpage); + *hpagep = p; diff --git a/queue-3.13/retrieving-cifs-acls-when-mounted-with-smb2-fails-dropping-session.patch b/queue-3.13/retrieving-cifs-acls-when-mounted-with-smb2-fails-dropping-session.patch new file mode 100644 index 00000000000..6cf6524c40b --- /dev/null +++ b/queue-3.13/retrieving-cifs-acls-when-mounted-with-smb2-fails-dropping-session.patch @@ -0,0 +1,159 @@ +From 83e3bc23ef9ce7c03b7b4e5d3d790246ea59db3e Mon Sep 17 00:00:00 2001 +From: Steve French +Date: Sun, 2 Feb 2014 23:31:47 -0600 +Subject: retrieving CIFS ACLs when mounted with SMB2 fails dropping session + +From: Steve French + +commit 83e3bc23ef9ce7c03b7b4e5d3d790246ea59db3e upstream. + +The get/set ACL xattr support for CIFS ACLs attempts to send old +cifs dialect protocol requests even when mounted with SMB2 or later +dialects. Sending cifs requests on an smb2 session causes problems - +the server drops the session due to the illegal request. + +This patch makes CIFS ACL operations protocol specific to fix that. + +Attempting to query/set CIFS ACLs for SMB2 will now return +EOPNOTSUPP (until we add worker routines for sending query +ACL requests via SMB2) instead of sending invalid (cifs) +requests. + +A separate followon patch will be needed to fix cifs_acl_to_fattr +(which takes a cifs specific u16 fid so can't be abstracted +to work with SMB2 until that is changed) and will be needed +to fix mount problems when "cifsacl" is specified on mount +with e.g. vers=2.1 + +Signed-off-by: Steve French +Reviewed-by: Shirish Pargaonkar +Signed-off-by: Greg Kroah-Hartman + +--- + fs/cifs/cifsacl.c | 28 ++++++++++++++++++++++++---- + fs/cifs/cifsglob.h | 4 ++++ + fs/cifs/smb1ops.c | 4 ++++ + fs/cifs/xattr.c | 15 +++++++++++---- + 4 files changed, 43 insertions(+), 8 deletions(-) + +--- a/fs/cifs/cifsacl.c ++++ b/fs/cifs/cifsacl.c +@@ -1027,15 +1027,30 @@ id_mode_to_cifs_acl(struct inode *inode, + __u32 secdesclen = 0; + struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */ + struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */ ++ struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb); ++ struct tcon_link *tlink = cifs_sb_tlink(cifs_sb); ++ struct cifs_tcon *tcon; ++ ++ if (IS_ERR(tlink)) ++ return PTR_ERR(tlink); ++ tcon = tlink_tcon(tlink); + + cifs_dbg(NOISY, "set ACL from mode for %s\n", path); + + /* Get the security descriptor */ +- pntsd = get_cifs_acl(CIFS_SB(inode->i_sb), inode, path, &secdesclen); ++ ++ if (tcon->ses->server->ops->get_acl == NULL) { ++ cifs_put_tlink(tlink); ++ return -EOPNOTSUPP; ++ } ++ ++ pntsd = tcon->ses->server->ops->get_acl(cifs_sb, inode, path, ++ &secdesclen); + if (IS_ERR(pntsd)) { + rc = PTR_ERR(pntsd); + cifs_dbg(VFS, "%s: error %d getting sec desc\n", __func__, rc); +- goto out; ++ cifs_put_tlink(tlink); ++ return rc; + } + + /* +@@ -1048,6 +1063,7 @@ id_mode_to_cifs_acl(struct inode *inode, + pnntsd = kmalloc(secdesclen, GFP_KERNEL); + if (!pnntsd) { + kfree(pntsd); ++ cifs_put_tlink(tlink); + return -ENOMEM; + } + +@@ -1056,14 +1072,18 @@ id_mode_to_cifs_acl(struct inode *inode, + + cifs_dbg(NOISY, "build_sec_desc rc: %d\n", rc); + ++ if (tcon->ses->server->ops->set_acl == NULL) ++ rc = -EOPNOTSUPP; ++ + if (!rc) { + /* Set the security descriptor */ +- rc = set_cifs_acl(pnntsd, secdesclen, inode, path, aclflag); ++ rc = tcon->ses->server->ops->set_acl(pnntsd, secdesclen, inode, ++ path, aclflag); + cifs_dbg(NOISY, "set_cifs_acl rc: %d\n", rc); + } ++ cifs_put_tlink(tlink); + + kfree(pnntsd); + kfree(pntsd); +-out: + return rc; + } +--- a/fs/cifs/cifsglob.h ++++ b/fs/cifs/cifsglob.h +@@ -391,6 +391,10 @@ struct smb_version_operations { + int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *, + const char *, const void *, const __u16, + const struct nls_table *, int); ++ struct cifs_ntsd * (*get_acl)(struct cifs_sb_info *, struct inode *, ++ const char *, u32 *); ++ int (*set_acl)(struct cifs_ntsd *, __u32, struct inode *, const char *, ++ int); + }; + + struct smb_version_values { +--- a/fs/cifs/smb1ops.c ++++ b/fs/cifs/smb1ops.c +@@ -1015,6 +1015,10 @@ struct smb_version_operations smb1_opera + .query_all_EAs = CIFSSMBQAllEAs, + .set_EA = CIFSSMBSetEA, + #endif /* CIFS_XATTR */ ++#ifdef CONFIG_CIFS_ACL ++ .get_acl = get_cifs_acl, ++ .set_acl = set_cifs_acl, ++#endif /* CIFS_ACL */ + }; + + struct smb_version_values smb1_values = { +--- a/fs/cifs/xattr.c ++++ b/fs/cifs/xattr.c +@@ -176,8 +176,12 @@ int cifs_setxattr(struct dentry *direntr + rc = -ENOMEM; + } else { + memcpy(pacl, ea_value, value_size); +- rc = set_cifs_acl(pacl, value_size, +- direntry->d_inode, full_path, CIFS_ACL_DACL); ++ if (pTcon->ses->server->ops->set_acl) ++ rc = pTcon->ses->server->ops->set_acl(pacl, ++ value_size, direntry->d_inode, ++ full_path, CIFS_ACL_DACL); ++ else ++ rc = -EOPNOTSUPP; + if (rc == 0) /* force revalidate of the inode */ + CIFS_I(direntry->d_inode)->time = 0; + kfree(pacl); +@@ -323,8 +327,11 @@ ssize_t cifs_getxattr(struct dentry *dir + u32 acllen; + struct cifs_ntsd *pacl; + +- pacl = get_cifs_acl(cifs_sb, direntry->d_inode, +- full_path, &acllen); ++ if (pTcon->ses->server->ops->get_acl == NULL) ++ goto get_ea_exit; /* rc already EOPNOTSUPP */ ++ ++ pacl = pTcon->ses->server->ops->get_acl(cifs_sb, ++ direntry->d_inode, full_path, &acllen); + if (IS_ERR(pacl)) { + rc = PTR_ERR(pacl); + cifs_dbg(VFS, "%s: error %zd getting sec desc\n", diff --git a/queue-3.13/series b/queue-3.13/series index 0ba4895483b..d1ffecf016a 100644 --- a/queue-3.13/series +++ b/queue-3.13/series @@ -1,2 +1,9 @@ xen-properly-account-for-_page_numa-during-xen-pte-translations.patch xen-blkfront-handle-backend-closed-without-closing.patch +fs-file.c-fdtable-avoid-triggering-ooms-from-alloc_fdmem.patch +mm-fix-page-leak-at-nfs_symlink.patch +mm-memory-failure.c-move-refcount-only-in-mf_count_increased.patch +arm-pxa-fix-various-compilation-problems.patch +cifs-fix-smb2-mounts-so-they-don-t-try-to-set-or-get-xattrs-via-cifs.patch +add-protocol-specific-operation-for-cifs-xattrs.patch +retrieving-cifs-acls-when-mounted-with-smb2-fails-dropping-session.patch