From abd39a8289c3bc2766f281933689d5140445aa85 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 19 Jul 2011 09:31:23 -0700 Subject: [PATCH] Fix zio_execute() deadlock To avoid deadlocking the system it is crucial that all memory allocations performed in the zio_execute() call path are marked KM_PUSHPAGE (GFP_NOFS). This ensures that while a z_wr_iss thread is processing the syncing transaction group it does not re-enter the filesystem code and deadlock on itself. Call Trace: [] cv_wait_common+0x78/0xe0 [spl] [] txg_wait_open+0x7b/0xa0 [zfs] [] dmu_tx_wait+0xed/0xf0 [zfs] [] zfs_putpage+0x219/0x360 [zfs] [] zpl_putpage+0x1e/0x60 [zfs] [] zpl_writepage+0x12/0x20 [zfs] [] writeout+0xa7/0xd0 [] move_to_new_page+0x13b/0x170 [] migrate_pages+0x434/0x4c0 [] compact_zone+0x4fb/0x780 [] compact_zone_order+0xa1/0xe0 [] try_to_compact_pages+0x11c/0x190 [] __alloc_pages_nodemask+0x5eb/0x8b0 [] kmem_getpages+0x62/0x170 [] fallback_alloc+0x1ba/0x270 [] ____cache_alloc_node+0x99/0x160 [] __kmalloc+0x189/0x220 [] kmem_alloc_debug+0xeb/0x130 [spl] [] dnode_hold_impl+0x46a/0x550 [zfs] [] dnode_hold+0x19/0x20 [zfs] [] dmu_read+0x33/0x180 [zfs] [] space_map_load+0xfd/0x320 [zfs] [] metaslab_activate+0x10c/0x170 [zfs] [] metaslab_alloc+0x469/0x800 [zfs] [] zio_dva_allocate+0x6c/0x2f0 [zfs] [] zio_execute+0x99/0xf0 [zfs] [] taskq_thread+0x1cc/0x330 [spl] [] kthread+0x96/0xa0 Signed-off-by: Brian Behlendorf Issue #291 --- module/zfs/dnode.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/module/zfs/dnode.c b/module/zfs/dnode.c index d341b58ee..9889c3c36 100644 --- a/module/zfs/dnode.c +++ b/module/zfs/dnode.c @@ -1074,7 +1074,8 @@ dnode_hold_impl(objset_t *os, uint64_t object, int flag, int i; dnode_children_t *winner; children_dnodes = kmem_alloc(sizeof (dnode_children_t) + - (epb - 1) * sizeof (dnode_handle_t), KM_SLEEP | KM_NODEBUG); + (epb - 1) * sizeof (dnode_handle_t), + KM_PUSHPAGE | KM_NODEBUG); children_dnodes->dnc_count = epb; dnh = &children_dnodes->dnc_children[0]; for (i = 0; i < epb; i++) {