From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 7 Oct 2016 10:07:40 +0200 From: Michal Hocko To: Dave Chinner Cc: linux-fsdevel@vger.kernel.org, xfs@oss.sgi.com, linux-mm@kvack.org, LKML Subject: lockdep splat due to reclaim recursion detected Message-ID: <20161007080739.GD18439@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Sender: owner-linux-mm@kvack.org List-ID: Hi Dave, while playing with the test case you have suggested [1], I have hit the following lockdep splat. This is with mmotm git tree [2] but I didn't get to retest with the current linux-next (or any other tree of your preference) so there is a chance that something is broken in my tree so take this as a heads up. As soon as I am done with testing of the patch in the above email thread I will retest with linux-next. [ 61.875155] ================================= [ 61.875716] [ INFO: inconsistent lock state ] [ 61.876293] 4.7.0-mmotm #995 Not tainted [ 61.876808] --------------------------------- [ 61.877347] inconsistent {IN-RECLAIM_FS-W} -> {RECLAIM_FS-ON-W} usage. [ 61.878150] fs_mark/3179 [HC0[0]:SC0[0]:HE1:SE1] takes: [ 61.878792] (&xfs_nondir_ilock_class){++++?.}, at: [] xfs_ilock_nowait+0x146/0x21c [xfs] [ 61.878792] {IN-RECLAIM_FS-W} state was registered at: [ 61.878792] [] __lock_acquire+0x3f1/0x156e [ 61.878792] [] lock_acquire+0x133/0x1c7 [ 61.878792] [] down_write_nested+0x26/0x55 [ 61.878792] [] xfs_ilock+0x158/0x1d8 [xfs] [ 61.878792] [] xfs_reclaim_inode+0x43/0x333 [xfs] [ 61.878792] [] xfs_reclaim_inodes_ag+0x2bc/0x364 [xfs] [ 61.878792] [] xfs_reclaim_inodes_nr+0x30/0x36 [xfs] [ 61.878792] [] xfs_fs_free_cached_objects+0x19/0x1b [xfs] [ 61.878792] [] super_cache_scan+0x156/0x179 [ 61.878792] [] shrink_slab+0x2c3/0x4d9 [ 61.878792] [] shrink_node+0x166/0x282 [ 61.878792] [] kswapd+0x63c/0x807 [ 61.878792] [] kthread+0xed/0xf5 [ 61.878792] [] ret_from_fork+0x1f/0x40 [ 61.878792] irq event stamp: 2484353 [ 61.878792] hardirqs last enabled at (2484353): [] bad_range+0x88/0x11d [ 61.878792] hardirqs last disabled at (2484352): [] bad_range+0x41/0x11d [ 61.878792] softirqs last enabled at (2482528): [] __do_softirq+0x33e/0x447 [ 61.878792] softirqs last disabled at (2482507): [] irq_exit+0x40/0x94 [ 61.878792] [ 61.878792] other info that might help us debug this: [ 61.878792] Possible unsafe locking scenario: [ 61.878792] [ 61.878792] CPU0 [ 61.878792] ---- [ 61.878792] lock(&xfs_nondir_ilock_class); [ 61.878792] [ 61.878792] lock(&xfs_nondir_ilock_class); [ 61.878792] [ 61.878792] *** DEADLOCK *** [ 61.878792] [ 61.878792] 6 locks held by fs_mark/3179: [ 61.878792] #0: (sb_writers#9){.+.+.+}, at: [] __sb_start_write+0x65/0xae [ 61.878792] #1: (&type->i_mutex_dir_key#4){+.+.+.}, at: [] path_openat+0x37c/0x7cd [ 61.878792] #2: (sb_internal#2){.+.+.+}, at: [] __sb_start_write+0xa0/0xae [ 61.878792] #3: (&(&ip->i_iolock)->mr_lock/4){+.+.+.}, at: [] xfs_ilock+0xef/0x1d8 [xfs] [ 61.878792] #4: (&xfs_dir_ilock_class/5){+.+.+.}, at: [] xfs_ilock+0x158/0x1d8 [xfs] [ 61.878792] #5: (&xfs_nondir_ilock_class){++++?.}, at: [] xfs_ilock_nowait+0x146/0x21c [xfs] [ 61.878792] [ 61.878792] stack backtrace: [ 61.878792] CPU: 0 PID: 3179 Comm: fs_mark Not tainted 4.7.0-mmotm #995 [ 61.878792] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Debian-1.8.2-1 04/01/2014 [ 61.878792] 0000000000000000 ffff88001c8b3718 ffffffff81312f78 ffffffff825d99d0 [ 61.878792] ffff88001cd04880 ffff88001c8b3750 ffffffff811260d1 000000000000000a [ 61.878792] ffff88001cd05178 ffff88001cd04880 ffffffff81095395 ffff88001cd04880 [ 61.878792] Call Trace: [ 61.878792] [] dump_stack+0x68/0x92 [ 61.878792] [] print_usage_bug.part.26+0x25b/0x26a [ 61.878792] [] ? print_shortest_lock_dependencies+0x17f/0x17f [ 61.878792] [] mark_lock+0x381/0x56d [ 61.878792] [] mark_held_locks+0x5e/0x74 [ 61.878792] [] lockdep_trace_alloc+0xaf/0xb2 [ 61.878792] [] kmem_cache_alloc_trace+0x3a/0x270 [ 61.878792] [] ? vm_map_ram+0x2d2/0x4a6 [ 61.878792] [] ? vm_map_ram+0xc9/0x4a6 [ 61.878792] [] vm_map_ram+0x2d2/0x4a6 [ 61.878792] [] _xfs_buf_map_pages+0xae/0x10b [xfs] [ 61.878792] [] xfs_buf_get_map+0xaa/0x24f [xfs] [ 61.878792] [] xfs_trans_get_buf_map+0x144/0x2ef [xfs] [ 61.878792] [] xfs_da_get_buf+0x81/0xc1 [xfs] [ 61.878792] [] xfs_dir3_data_init+0x5b/0x1ae [xfs] [ 61.878792] [] xfs_dir2_node_addname+0x62e/0x915 [xfs] [ 61.878792] [] ? xfs_dir2_node_addname+0x62e/0x915 [xfs] [ 61.878792] [] xfs_dir_createname+0x15e/0x17b [xfs] [ 61.878792] [] xfs_create+0x38a/0x698 [xfs] [ 61.878792] [] xfs_generic_create+0xc8/0x1e2 [xfs] [ 61.878792] [] xfs_vn_mknod+0x14/0x16 [xfs] [ 61.878792] [] xfs_vn_create+0x13/0x15 [xfs] [ 61.878792] [] lookup_open+0x45e/0x55a [ 61.878792] [] path_openat+0x3a7/0x7cd [ 61.878792] [] ? __lock_acquire+0x950/0x156e [ 61.878792] [] do_filp_open+0x4d/0xa3 [ 61.878792] [] ? __alloc_fd+0x1b2/0x1c4 [ 61.878792] [] ? _raw_spin_unlock+0x31/0x44 [ 61.878792] [] ? __alloc_fd+0x1b2/0x1c4 [ 61.878792] [] do_sys_open+0x140/0x1d0 [ 61.878792] [] ? do_sys_open+0x140/0x1d0 [ 61.878792] [] SyS_open+0x1e/0x20 [ 61.878792] [] entry_SYSCALL_64_fastpath+0x18/0xa8 [1] http://lkml.kernel.org/r/20161004203202.GY9806@dastard [2] git://git.kernel.org/pub/scm/linux/kernel/git/mhocko/mm.git #since-4.7 which is v4.7 + all mmotm mm related patches. -- Michal Hocko SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@kvack.org. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: email@kvack.org