X-Spam-Checker-Version: SpamAssassin 3.3.0-rupdated (updated) on oss.sgi.com X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.0-rupdated Received: from cuda.sgi.com (cuda3.sgi.com [192.48.176.15]) by oss.sgi.com (8.14.3/8.14.3/SuSE Linux 0.8) with ESMTP id n1KMcstI205836 for ; Fri, 20 Feb 2009 16:38:54 -0600 X-ASG-Debug-ID: 1235169501-5efd006f0000-NocioJ X-Barracuda-URL: http://cuda.sgi.com:80/cgi-bin/mark.cgi Received: from smtp1.linux-foundation.org (localhost [127.0.0.1]) by cuda.sgi.com (Spam Firewall) with ESMTP id B579819811F6 for ; Fri, 20 Feb 2009 14:38:22 -0800 (PST) Received: from smtp1.linux-foundation.org (smtp1.linux-foundation.org [140.211.169.13]) by cuda.sgi.com with ESMTP id Yt4xHcXQNQHsYjUr for ; Fri, 20 Feb 2009 14:38:22 -0800 (PST) Received: from imap1.linux-foundation.org (imap1.linux-foundation.org [140.211.169.55]) by smtp1.linux-foundation.org (8.14.2/8.13.5/Debian-3ubuntu1.1) with ESMTP id n1KKMgwC009294 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 20 Feb 2009 12:22:44 -0800 Received: from akpm.corp.google.com (localhost [127.0.0.1]) by imap1.linux-foundation.org (8.13.5.20060308/8.13.5/Debian-3ubuntu1.1) with SMTP id n1KKMgVp029959; Fri, 20 Feb 2009 12:22:42 -0800 Date: Fri, 20 Feb 2009 12:22:42 -0800 From: Andrew Morton To: Alexander Beregalov Cc: linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, xfs@oss.sgi.com, zohar@linux.vnet.ibm.com X-ASG-Orig-Subj: Re: next-20090220: XFS, IMA: BUG: sleeping function called from invalid context at mm/slub.c:1613 Subject: Re: next-20090220: XFS, IMA: BUG: sleeping function called from invalid context at mm/slub.c:1613 Message-Id: <20090220122242.b36a778f.akpm@linux-foundation.org> In-Reply-To: References: X-Mailer: Sylpheed version 2.2.4 (GTK+ 2.8.20; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-MIMEDefang-Filter: lf$Revision: 1.188 $ X-Scanned-By: MIMEDefang 2.63 on 140.211.169.13 X-Barracuda-Connect: smtp1.linux-foundation.org[140.211.169.13] X-Barracuda-Start-Time: 1235169502 X-Barracuda-Virus-Scanned: by cuda.sgi.com at sgi.com X-ASG-Whitelist: BODY (http://marc\.info/\?) X-Virus-Scanned: ClamAV version 0.94.2, clamav-milter version 0.94.2 on oss.sgi.com X-Virus-Status: Clean On Fri, 20 Feb 2009 14:00:21 +0300 Alexander Beregalov wrote: > Hi > > I have applied the following patch from Mimi Zohar > http://marc.info/?l=linux-next&m=123509665514552 > > That is why it is dirty. > The kernel can not boot without it when IMA is enabled. > > > BUG: sleeping function called from invalid context at mm/slub.c:1613 > in_atomic(): 1, irqs_disabled(): 0, pid: 1514, name: mkdir > 3 locks held by mkdir/1514: > #0: (&type->i_mutex_dir_key#2/1){+.+.+.}, at: [] > lookup_create+0x30/0xd0 > #1: (&(&ip->i_lock)->mr_lock/1){+.+.+.}, at: [] > xfs_ilock+0xdf/0x120 > #2: (&pag->pag_ici_lock){++++.+}, at: [] > xfs_iget+0x156/0x650 > Pid: 1514, comm: mkdir Not tainted 2.6.29-rc5-next-20090220-dirty #1 > Call Trace: > [] ? __debug_show_held_locks+0x13/0x30 > [] __might_sleep+0x105/0x140 > [] kmem_cache_alloc+0xd1/0x100 > [] ima_iint_insert+0x49/0xf0 > [] ima_inode_alloc+0x1d/0x30 > [] inode_init_always+0xaf/0x250 > [] xfs_iget+0x206/0x650 > [] xfs_trans_iget+0x208/0x250 > [] xfs_ialloc+0xc1/0x700 > [] xfs_dir_ialloc+0xa9/0x340 > [] ? down_write_nested+0x79/0x90 > [] xfs_create+0x3e1/0x690 > [] xfs_vn_mknod+0x63/0xf0 > [] xfs_vn_mkdir+0xe/0x10 > [] vfs_mkdir+0x8c/0xd0 > [] sys_mkdirat+0x106/0x120 > [] ? sysret_check+0x27/0x62 > [] ? trace_hardirqs_on_caller+0x17d/0x1e0 > [] sys_mkdir+0x13/0x20 > [] system_call_fastpath+0x16/0x1b > BUG: sleeping function called from invalid context at mm/slub.c:1613 Please do not be tempted to switch ima_iint_insert() to use GFP_ATOMIC to "fix" this. Arguably, ima_iint_insert() should requite that the caller pass in the gfp_t rather than assuming that GFP_KERNEL can be used. But that is not a suitable fix for this bug. We may need to make that change to ima_iint_insert() anyway, as there's a good chance that callers will require GFP_NOFS. But to fix this bug, xfs needs to stop calling inode_init_always() under read_lock(). Because inode_alloc_security() also can sleep (see new_inode_smack()). Also, ima_iint_insert() does a radix_tree_lookup() without holding ima_iint_lock, which appears to be a bug.