From mboxrd@z Thu Jan 1 00:00:00 1970 From: "J. Bruce Fields" Subject: allocation under spinlock Date: Wed, 24 Feb 2010 16:23:58 -0500 Message-ID: <20100224212358.GH16665@fieldses.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-nfs@vger.kernel.org To: Trond Myklebust Return-path: Received: from fieldses.org ([174.143.236.118]:41338 "EHLO fieldses.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758157Ab0BXVXE (ORCPT ); Wed, 24 Feb 2010 16:23:04 -0500 Sender: linux-nfs-owner@vger.kernel.org List-ID: nfs_dns_ent_init() is trying to kstrndup() something, but it's called under a spinlock. Could refernce count that string instead, but other code I believe actually just does something like: new->hostname = key->hostname; key->hostname = NULL; --b. BUG: sleeping function called from invalid context at mm/slab.c:3034 in_atomic(): 1, irqs_disabled(): 0, pid: 3300, name: nfs_cache_geten 2 locks held by nfs_cache_geten/3300: #0: (&sb->s_type->i_mutex_key#4){+.+.+.}, at: [] cache_write+0x46/0x100 #1: (&cd->hash_lock){+++++.}, at: [] sunrpc_cache_update+0x25/0x170 Pid: 3300, comm: nfs_cache_geten Not tainted 2.6.33-rc8-13669-g724e6d3 #156 Call Trace: [] ? printk+0x1d/0x1f [] __might_sleep+0x100/0x130 [] __kmalloc_track_caller+0x189/0x230 [] ? kfree+0xd4/0x180 [] ? nfs_dns_ent_init+0x26/0x70 [] kstrndup+0x34/0x60 [] nfs_dns_ent_init+0x26/0x70 [] sunrpc_cache_update+0x138/0x170 [] ? nfs_dns_lookup+0x53/0x70 [] nfs_dns_parse+0x194/0x1e0 [] ? add_lock_to_list+0x40/0xc0 [] ? __lock_acquire+0x109a/0x1890 [] ? add_to_page_cache_locked+0x65/0x140 [] ? lock_release_non_nested+0x59/0x2f0 [] ? mark_held_locks+0x62/0x90 [] ? might_fault+0x62/0xb0 [] ? might_fault+0x62/0xb0 [] ? might_fault+0xa8/0xb0 [] ? might_fault+0x62/0xb0 [] cache_do_downcall+0x3a/0x50 [] cache_write+0xa0/0x100 [] ? rw_verify_area+0x62/0xd0 [] cache_write_pipefs+0x27/0x30 [] vfs_write+0xa2/0x170 [] ? up_read+0x1b/0x30 [] ? cache_write_pipefs+0x0/0x30 [] ? do_page_fault+0x160/0x3f0 [] sys_write+0x42/0x70 [] syscall_call+0x7/0xb