From: Jan Kara Subject: Re: Circular locking dependency with delalloc Date: Wed, 28 May 2008 18:38:05 +0200 Message-ID: <20080528163805.GB32634@atrey.karlin.mff.cuni.cz> References: <20080522095011.GA30056@skywalker> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Mingming , "linux-ext4@vger.kernel.org" To: "Aneesh Kumar K.V" Return-path: Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:33357 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751303AbYE1QiH (ORCPT ); Wed, 28 May 2008 12:38:07 -0400 Content-Disposition: inline In-Reply-To: <20080522095011.GA30056@skywalker> Sender: linux-ext4-owner@vger.kernel.org List-ID: Hi Aneesh, I think it was this lock inversion you mentioned in one of your emails... > ======================================================= > [ INFO: possible circular locking dependency detected ] > 2.6.26-rc2 #56 > ------------------------------------------------------- > umount/2662 is trying to acquire lock: > (jbd2_handle){--..}, at: [] jbd2_journal_start+0xce/0xf0 > > but task is already holding lock: > (&type->s_lock_key#7){--..}, at: [] lock_super+0x1b/0x1d > > which lock already depends on the new lock. > > > the existing dependency chain (in reverse order) is: > > -> #2 (&type->s_lock_key#7){--..}: > [] __lock_acquire+0x97f/0xb32 > [] lock_acquire+0x6c/0x89 > [] mutex_lock_nested+0xc9/0x248 > [] lock_super+0x1b/0x1d > [] ext4_orphan_add+0x1b/0x12e > [] ext4_ext_truncate+0x99/0x166 > [] ext4_truncate+0x84/0x40d > [] ext4_delete_inode+0x74/0xc0 > [] generic_delete_inode+0x61/0xcb > [] generic_drop_inode+0x12/0x137 > [] iput+0x4b/0x4e > [] do_unlinkat+0xd3/0x145 > [] sys_unlink+0x10/0x12 > [] sysenter_past_esp+0x6a/0xb1 > [] 0xffffffff > > -> #1 (&ei->i_data_sem){----}: > [] __lock_acquire+0x97f/0xb32 > [] lock_acquire+0x6c/0x89 > [] down_read+0x2b/0x65 > [] ext4_get_blocks_wrap+0x2b/0xfc > [] ext4_getblk+0x49/0x18a > [] ext4_find_entry+0x331/0x58b > [] ext4_unlink+0x6e/0x18e > [] vfs_unlink+0x4d/0xa5 > [] do_unlinkat+0xa7/0x145 > [] sys_unlink+0x10/0x12 > [] sysenter_past_esp+0x6a/0xb1 > [] 0xffffffff > > -> #0 (jbd2_handle){--..}: > [] __lock_acquire+0x8a6/0xb32 > [] lock_acquire+0x6c/0x89 > [] jbd2_journal_start+0xe3/0xf0 > [] ext4_journal_start_sb+0x40/0x42 > [] ext4_da_writepages+0x45/0xbb > [] do_writepages+0x23/0x34 > [] __writeback_single_inode+0x12a/0x260 > [] write_inode_now+0x72/0xbc > [] generic_drop_inode+0x91/0x137 > [] iput+0x4b/0x4e > [] jbd2_journal_destroy+0x19f/0x1c9 > [] ext4_put_super+0x35/0x18d > [] generic_shutdown_super+0x52/0xd3 > [] kill_block_super+0xf/0x20 > [] deactivate_super+0x3f/0x51 > [] mntput_no_expire+0xba/0xdd > [] sys_umount+0x259/0x29b > [] sysenter_past_esp+0x6a/0xb1 > [] 0xffffffff What has changed is that now we start a transaction before we find any pages to write. During dropping of journal inode (which is the trace above), there are actually no dirty pages so previously we didn't start a transaction but now we do start it... So this is mostly cosmetic error (I think no real deadlock can be triggered) but I agree we should fix it. Probably by somehow detecting that we are shutting down superblock in ext4_da_writepages() and simply return - if there are any dirty data by that time, we are screwed anyway... > other info that might help us debug this: > > 2 locks held by umount/2662: > #0: (&type->s_umount_key#17){----}, at: [] deactivate_super+0x3a/0x51 > #1: (&type->s_lock_key#7){--..}, at: [] lock_super+0x1b/0x1d > > stack backtrace: > Pid: 2662, comm: umount Not tainted 2.6.26-rc2 #56 > [] print_circular_bug_tail+0x5b/0x66 > [] __lock_acquire+0x8a6/0xb32 > [] ? _spin_unlock+0x27/0x3c > [] lock_acquire+0x6c/0x89 > [] ? jbd2_journal_start+0xce/0xf0 > [] jbd2_journal_start+0xe3/0xf0 > [] ? jbd2_journal_start+0xce/0xf0 > [] ext4_journal_start_sb+0x40/0x42 > [] ext4_da_writepages+0x45/0xbb > [] ? ext4_da_writepages+0x0/0xbb > [] do_writepages+0x23/0x34 > [] __writeback_single_inode+0x12a/0x260 > [] write_inode_now+0x72/0xbc > [] generic_drop_inode+0x91/0x137 > [] iput+0x4b/0x4e > [] jbd2_journal_destroy+0x19f/0x1c9 > [] ? autoremove_wake_function+0x0/0x33 > [] ext4_put_super+0x35/0x18d > [] generic_shutdown_super+0x52/0xd3 > [] kill_block_super+0xf/0x20 > [] deactivate_super+0x3f/0x51 > [] mntput_no_expire+0xba/0xdd > [] sys_umount+0x259/0x29b > [] ? vfs_stat+0x11/0x13 > [] ? sysenter_past_esp+0xa5/0xb1 > [] sysenter_past_esp+0x6a/0xb1 > ======================= > [ OK ] > Honza -- Jan Kara SuSE CR Labs