From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Larsson Subject: ovl_copy_xattr page allocation failure Date: Tue, 19 Aug 2014 12:50:10 +0200 Message-ID: <1408445410.29096.9.camel@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Cc: linux-fsdevel@vger.kernel.org To: miklos@szeredi.hu Return-path: Received: from mx1.redhat.com ([209.132.183.28]:36418 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751729AbaHSKuO (ORCPT ); Tue, 19 Aug 2014 06:50:14 -0400 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: When using overlayfs I pretty quickly run into a "page allocation failure: order:4, mode:0x40d0" that looks like this: Call Trace: [] dump_stack+0x45/0x56 [] warn_alloc_failed+0xff/0x170 [] __alloc_pages_nodemask+0x6e5/0xbf0 [] alloc_pages_current+0xb1/0x160 [] alloc_kmem_pages+0x3b/0x110 [] kmalloc_order+0x18/0x50 [] kmalloc_order_trace+0x24/0xa0 [] ? ovl_copy_xattr+0x6a/0x170 [overlayf [] ovl_copy_xattr+0x8b/0x170 [overlayfs] [] ? ovl_create_real+0x108/0x240 [overla [] ovl_copy_up_one+0x33e/0x7f0 [overlayf [] ? selinux_sem_alloc_security+0x7d/0xd [] ovl_copy_up+0xe9/0x120 [overlayfs] [] ovl_do_remove+0x81/0x4a0 [overlayfs] [] ? may_link.isra.31+0x93/0x120 [] ? __inode_permission+0x4a/0xc0 [] ovl_unlink+0x13/0x20 [overlayfs] [] vfs_unlink+0xe6/0x160 [] do_unlinkat+0x27e/0x2f0 [] SyS_unlink+0x16/0x20 [] system_call_fastpath+0x16/0x1b This seems to be from value = kmalloc(XATTR_SIZE_MAX, GFP_KERNEL); in ovl_copy_xattr(). XATTR_SIZE_MAX is 64k, so its probably a bad idea to always allocate this GFP_KERNEL. We should probably start with a small stack-allocated buffer and then only allocate what is required. Note: The reason I hit this is probably due to selinux, which ensure that most files have an xattr (the selinux context).