From mboxrd@z Thu Jan 1 00:00:00 1970 From: Lachlan McIlroy Subject: Re: possible deadlock shown by CONFIG_PROVE_LOCKING Date: Fri, 25 Jan 2008 13:00:57 +1100 Message-ID: <479942D9.6000302@sgi.com> References: <18328.37831.359806.359123@fisica.ufpr.br> Reply-To: lachlan@sgi.com Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------060503000403000906000305" Cc: linux-fsdevel@vger.kernel.org To: Carlos Carvalho Return-path: Received: from netops-testserver-3-out.sgi.com ([192.48.171.28]:38375 "EHLO relay.sgi.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751998AbYAYB53 (ORCPT ); Thu, 24 Jan 2008 20:57:29 -0500 In-Reply-To: <18328.37831.359806.359123@fisica.ufpr.br> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: This is a multi-part message in MIME format. --------------060503000403000906000305 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Carlos Carvalho wrote: > I compiled the kernel with Ingo's CONFIG_PROVE_LOCKING and got the > below at boot. Is it a problem? It was a problem - it has since been fixed in 2.6.23. Patch is attached in case you're interested. > > Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar > ... MAX_LOCKDEP_SUBCLASSES: 8 > ... MAX_LOCK_DEPTH: 30 > ... MAX_LOCKDEP_KEYS: 2048 > ... CLASSHASH_SIZE: 1024 > ... MAX_LOCKDEP_ENTRIES: 8192 > ... MAX_LOCKDEP_CHAINS: 16384 > ... CHAINHASH_SIZE: 8192 > memory used by lock dependency info: 1648 kB > per task-struct memory footprint: 1680 bytes > ------------------------ > | Locking API testsuite: > ---------------------------------------------------------------------------- > [removed] > ------------------------------------------------------- > Good, all 218 testcases passed! | > --------------------------------- > > Further down > > md: running: > raid1: raid set md3 active with 2 out of 2 mirrors > md: ... autorun DONE. > Filesystem "md1": Disabling barriers, not supported by the underlying device > XFS mounting filesystem md1 > Ending clean XFS mount for filesystem: md1 > VFS: Mounted root (xfs filesystem). > Freeing unused kernel memory: 284k freed > Warning: unable to open an initial console. > Filesystem "md1": Disabling barriers, not supported by the underlying device > > ======================================================= > [ INFO: possible circular locking dependency detected ] > 2.6.22.16 #1 > ------------------------------------------------------- > mount/1558 is trying to acquire lock: > (&(&ip->i_lock)->mr_lock/1){--..}, at: [] xfs_ilock+0x63/0x8d > > but task is already holding lock: > (&(&ip->i_lock)->mr_lock){----}, at: [] xfs_ilock+0x63/0x8d > > which lock already depends on the new lock. > > the existing dependency chain (in reverse order) is: > > -> #1 (&(&ip->i_lock)->mr_lock){----}: > [] __lock_acquire+0xa0f/0xb9f > [] lock_acquire+0x48/0x63 > [] xfs_ilock+0x63/0x8d > [] down_write_nested+0x38/0x46 > [] xfs_ilock+0x63/0x8d > [] xfs_iget_core+0x3ef/0x705 > [] xfs_iget+0xa4/0x14e > [] xfs_trans_iget+0xb4/0x128 > [] xfs_ialloc+0x9b/0x4b7 > [] __lock_acquire+0xa32/0xb9f > [] xfs_dir_ialloc+0x84/0x2cd > [] xfs_ilock+0x63/0x8d > [] down_write_nested+0x38/0x46 > [] xfs_create+0x331/0x65f > [] xfs_dir2_leaf_lookup+0x1d/0x96 > [] xfs_vn_mknod+0x12f/0x1f2 > [] vfs_create+0x6e/0x9e > [] open_namei+0x1f7/0x6a9 > [] do_page_fault+0x438/0x78f > [] do_filp_open+0x1c/0x3d > [] _spin_unlock+0x17/0x20 > [] get_unused_fd+0x11c/0x12a > [] do_sys_open+0x40/0x7b > [] system_call+0x7e/0x83 > [] 0xffffffffffffffff > > -> #0 (&(&ip->i_lock)->mr_lock/1){--..}: > [] print_circular_bug_header+0xcc/0xd3 > [] __lock_acquire+0x90b/0xb9f > [] lock_acquire+0x48/0x63 > [] xfs_ilock+0x63/0x8d > [] down_write_nested+0x38/0x46 > [] xfs_ilock+0x63/0x8d > [] xfs_lock_inodes+0x152/0x16d > [] xfs_link+0x1d2/0x3f7 > [] __lock_acquire+0x9a8/0xb9f > [] xfs_vn_link+0x3c/0x91 > [] mark_held_locks+0x58/0x72 > [] __mutex_lock_slowpath+0x250/0x266 > [] trace_hardirqs_on+0x115/0x139 > [] __mutex_lock_slowpath+0x25b/0x266 > [] vfs_link+0xe8/0x124 > [] sys_linkat+0xcd/0x129 > [] trace_hardirqs_on_thunk+0x35/0x37 > [] trace_hardirqs_on+0x115/0x139 > [] trace_hardirqs_on_thunk+0x35/0x37 > [] system_call+0x7e/0x83 > [] 0xffffffffffffffff > > other info that might help us debug this: > > 3 locks held by mount/1558: > #0: (&inode->i_mutex/1){--..}, at: [] lookup_create+0x23/0x8 > 5 > #1: (&inode->i_mutex){--..}, at: [] vfs_link+0xd5/0x124 > #2: (&(&ip->i_lock)->mr_lock){----}, at: [] xfs_ilock+0x63/0 > x8d > > stack backtrace: > > Call Trace: > [] print_circular_bug_tail+0x69/0x72 > [] print_circular_bug_header+0xcc/0xd3 > [] __lock_acquire+0x90b/0xb9f > [] lock_acquire+0x48/0x63 > [] xfs_ilock+0x63/0x8d > [] down_write_nested+0x38/0x46 > [] xfs_ilock+0x63/0x8d > [] xfs_lock_inodes+0x152/0x16d > [] xfs_link+0x1d2/0x3f7 > [] __lock_acquire+0x9a8/0xb9f > [] xfs_vn_link+0x3c/0x91 > [] mark_held_locks+0x58/0x72 > [] __mutex_lock_slowpath+0x250/0x266 > [] trace_hardirqs_on+0x115/0x139 > [] __mutex_lock_slowpath+0x25b/0x266 > [] vfs_link+0xe8/0x124 > [] sys_linkat+0xcd/0x129 > [] trace_hardirqs_on_thunk+0x35/0x37 > [] trace_hardirqs_on+0x115/0x139 > [] trace_hardirqs_on_thunk+0x35/0x37 > [] system_call+0x7e/0x83 > - > To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > --------------060503000403000906000305 Content-Type: text/plain; name="diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diff" commit 0f1145cc18e970ebe37da114fc34c297f135e062 Author: David Chinner Date: Fri Jun 29 17:26:09 2007 +1000 [XFS] Fix lockdep annotations for xfs_lock_inodes SGI-PV: 967035 SGI-Modid: xfs-linux-melb:xfs-kern:29026a Signed-off-by: David Chinner Signed-off-by: Tim Shimmin diff --git a/fs/xfs/xfs_inode.h b/fs/xfs/xfs_inode.h index d418eee..012dfd4 100644 --- a/fs/xfs/xfs_inode.h +++ b/fs/xfs/xfs_inode.h @@ -415,19 +415,22 @@ xfs_iflags_test(xfs_inode_t *ip, unsigne * gets a lockdep subclass of 1 and the second lock will have a lockdep * subclass of 0. * - * XFS_I[O]LOCK_INUMORDER - for locking several inodes at the some time + * XFS_LOCK_INUMORDER - for locking several inodes at the some time * with xfs_lock_inodes(). This flag is used as the starting subclass * and each subsequent lock acquired will increment the subclass by one. * So the first lock acquired will have a lockdep subclass of 2, the - * second lock will have a lockdep subclass of 3, and so on. + * second lock will have a lockdep subclass of 3, and so on. It is + * the responsibility of the class builder to shift this to the correct + * portion of the lock_mode lockdep mask. */ +#define XFS_LOCK_PARENT 1 +#define XFS_LOCK_INUMORDER 2 + #define XFS_IOLOCK_SHIFT 16 -#define XFS_IOLOCK_PARENT (1 << XFS_IOLOCK_SHIFT) -#define XFS_IOLOCK_INUMORDER (2 << XFS_IOLOCK_SHIFT) +#define XFS_IOLOCK_PARENT (XFS_LOCK_PARENT << XFS_IOLOCK_SHIFT) #define XFS_ILOCK_SHIFT 24 -#define XFS_ILOCK_PARENT (1 << XFS_ILOCK_SHIFT) -#define XFS_ILOCK_INUMORDER (2 << XFS_ILOCK_SHIFT) +#define XFS_ILOCK_PARENT (XFS_LOCK_PARENT << XFS_ILOCK_SHIFT) #define XFS_IOLOCK_DEP_MASK 0x00ff0000 #define XFS_ILOCK_DEP_MASK 0xff000000 diff --git a/fs/xfs/xfs_vnodeops.c b/fs/xfs/xfs_vnodeops.c index 60fd0be..79b5227 100644 --- a/fs/xfs/xfs_vnodeops.c +++ b/fs/xfs/xfs_vnodeops.c @@ -2224,9 +2224,9 @@ static inline int xfs_lock_inumorder(int lock_mode, int subclass) { if (lock_mode & (XFS_IOLOCK_SHARED|XFS_IOLOCK_EXCL)) - lock_mode |= (subclass + XFS_IOLOCK_INUMORDER) << XFS_IOLOCK_SHIFT; + lock_mode |= (subclass + XFS_LOCK_INUMORDER) << XFS_IOLOCK_SHIFT; if (lock_mode & (XFS_ILOCK_SHARED|XFS_ILOCK_EXCL)) - lock_mode |= (subclass + XFS_ILOCK_INUMORDER) << XFS_ILOCK_SHIFT; + lock_mode |= (subclass + XFS_LOCK_INUMORDER) << XFS_ILOCK_SHIFT; return lock_mode; } --------------060503000403000906000305--