From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from psmtp.com (na3sys010amx185.postini.com [74.125.245.185]) by kanga.kvack.org (Postfix) with SMTP id 7BEB36B002C for ; Thu, 8 Mar 2012 04:16:06 -0500 (EST) Received: from /spool/local by e23smtp07.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Mar 2012 09:10:27 +1000 Received: from d23av02.au.ibm.com (d23av02.au.ibm.com [9.190.235.138]) by d23relay05.au.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id q2899uT22617500 for ; Thu, 8 Mar 2012 20:10:04 +1100 Received: from d23av02.au.ibm.com (loopback [127.0.0.1]) by d23av02.au.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id q289Fbvc032009 for ; Thu, 8 Mar 2012 20:15:37 +1100 From: "Aneesh Kumar K.V" Subject: [PATCH] hugetlbfs: lockdep annotate root inode properly Date: Thu, 8 Mar 2012 14:45:16 +0530 Message-Id: <1331198116-13670-1-git-send-email-aneesh.kumar@linux.vnet.ibm.com> Sender: owner-linux-mm@kvack.org List-ID: To: linux-mm@kvack.org, akpm@linux-foundation.org, davej@redhat.com, jboyer@redhat.com, tyhicks@canonical.com Cc: linux-kernel@vger.kernel.org, "Aneesh Kumar K.V" From: "Aneesh Kumar K.V" This fix the below lockdep warning ====================================================== [ INFO: possible circular locking dependency detected ] 3.3.0-rc4+ #190 Not tainted ------------------------------------------------------- shared/1568 is trying to acquire lock: (&sb->s_type->i_mutex_key#12){+.+.+.}, at: [] hugetlbfs_file_mmap+0x7d/0x108 but task is already holding lock: (&mm->mmap_sem){++++++}, at: [] sys_mmap_pgoff+0xd4/0x12f which lock already depends on the new lock. the existing dependency chain (in reverse order) is: -> #1 (&mm->mmap_sem){++++++}: [] lock_acquire+0xd5/0xfa [] might_fault+0x6d/0x90 [] filldir+0x6a/0xc2 [] dcache_readdir+0x5c/0x222 [] vfs_readdir+0x76/0xac [] sys_getdents+0x79/0xc9 [] system_call_fastpath+0x16/0x1b -> #0 (&sb->s_type->i_mutex_key#12){+.+.+.}: [] __lock_acquire+0xa6c/0xd60 [] lock_acquire+0xd5/0xfa [] __mutex_lock_common+0x48/0x350 [] mutex_lock_nested+0x2a/0x31 [] hugetlbfs_file_mmap+0x7d/0x108 [] mmap_region+0x26f/0x466 [] do_mmap_pgoff+0x294/0x2ee [] sys_mmap_pgoff+0xf4/0x12f [] sys_mmap+0x1d/0x1f [] system_call_fastpath+0x16/0x1b other info that might help us debug this: Possible unsafe locking scenario: CPU0 CPU1 ---- ---- lock(&mm->mmap_sem); lock(&sb->s_type->i_mutex_key#12); lock(&mm->mmap_sem); lock(&sb->s_type->i_mutex_key#12); *** DEADLOCK *** 1 lock held by shared/1568: #0: (&mm->mmap_sem){++++++}, at: [] sys_mmap_pgoff+0xd4/0x12f stack backtrace: Pid: 1568, comm: shared Not tainted 3.3.0-rc4+ #190 Call Trace: [] print_circular_bug+0x1f8/0x209 [] __lock_acquire+0xa6c/0xd60 [] ? files_lglock_local_lock_cpu+0x61/0x61 [] ? hugetlbfs_file_mmap+0x7d/0x108 [] lock_acquire+0xd5/0xfa [] ? hugetlbfs_file_mmap+0x7d/0x108 Signed-off-by: Aneesh Kumar K.V --- fs/hugetlbfs/inode.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) NOTE: This patch also require http://thread.gmane.org/gmane.linux.file-systems/58795/focus=59565 to remove the lockdep warning diff --git a/fs/hugetlbfs/inode.c b/fs/hugetlbfs/inode.c index 3645cd3..ca4fa70 100644 --- a/fs/hugetlbfs/inode.c +++ b/fs/hugetlbfs/inode.c @@ -459,6 +459,7 @@ static struct inode *hugetlbfs_get_root(struct super_block *sb, inode->i_fop = &simple_dir_operations; /* directory inodes start off with i_nlink == 2 (for "." entry) */ inc_nlink(inode); + lockdep_annotate_inode_mutex_key(inode); } return inode; } -- 1.7.9 -- 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/ . Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/ Don't email: email@kvack.org