Bug 795805

Summary: possible circular locking dependency mm->&mmap_sem --> &sb->s_type->i_mutex_key
Product: [Fedora] Fedora Reporter: Mikko Tiihonen <mikko.tiihonen>
Component: kernelAssignee: Kernel Maintainer List <kernel-maint>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 17CC: gansalmon, itamar, jforbes, jonathan, kernel-maint, madhu.chinakonda
Target Milestone: ---   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-05-11 13:40:14 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Mikko Tiihonen 2012-02-21 15:12:23 UTC
Version-Release number of selected component (if applicable):
kernel-3.3.0-0.rc3.git7.2.fc17.x86_64

[ INFO: possible circular locking dependency detected ]
3.3.0-0.rc3.git7.2.fc17.x86_64 #1 Not tainted
-------------------------------------------------------
btrfs-show/9148 is trying to acquire lock:
 (&mm->mmap_sem){++++++}, at: [<ffffffff8117431c>] might_fault+0x5c/0xb0

but task is already holding lock:
 (&sb->s_type->i_mutex_key#18){+.+.+.}, at: [<ffffffff811d0c32>] vfs_readdir+0x82/0xf0

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

-> #1 (&sb->s_type->i_mutex_key#18){+.+.+.}:
       [<ffffffff810ccb91>] lock_acquire+0xa1/0x1e0
       [<ffffffff8169a316>] mutex_lock_nested+0x76/0x3a0
       [<ffffffff81297e4a>] hugetlbfs_file_mmap+0x8a/0x120
       [<ffffffff8117df8a>] mmap_region+0x3ca/0x590
       [<ffffffff8117e495>] do_mmap_pgoff+0x345/0x390
       [<ffffffff8117e6f6>] sys_mmap_pgoff+0x216/0x270
       [<ffffffff8101dad2>] sys_mmap+0x22/0x30
       [<ffffffff816a6f29>] system_call_fastpath+0x16/0x1b

-> #0 (&mm->mmap_sem){++++++}:
       [<ffffffff810cbdc8>] __lock_acquire+0x13d8/0x1ad0
       [<ffffffff810ccb91>] lock_acquire+0xa1/0x1e0
       [<ffffffff81174349>] might_fault+0x89/0xb0
       [<ffffffff811d0966>] filldir+0x76/0xf0
       [<ffffffff811e4169>] dcache_readdir+0x69/0x240
       [<ffffffff811d0c68>] vfs_readdir+0xb8/0xf0
       [<ffffffff811d0d9a>] sys_getdents+0x8a/0x100
       [<ffffffff816a6f29>] system_call_fastpath+0x16/0x1b

other info that might help us debug this:

 Possible unsafe locking scenario:

       CPU0                    CPU1
       ----                    ----
  lock(&sb->s_type->i_mutex_key#18);
                               lock(&mm->mmap_sem);
                               lock(&sb->s_type->i_mutex_key#18);
  lock(&mm->mmap_sem);

 *** DEADLOCK ***

1 lock held by btrfs-show/9148:
 #0:  (&sb->s_type->i_mutex_key#18){+.+.+.}, at: [<ffffffff811d0c32>] vfs_readdir+0x82/0xf0

stack backtrace:
Pid: 9148, comm: btrfs-show Not tainted 3.3.0-0.rc3.git7.2.fc17.x86_64 #1
Call Trace:
 [<ffffffff81692a4e>] print_circular_bug+0x1fb/0x20c
 [<ffffffff810cbdc8>] __lock_acquire+0x13d8/0x1ad0
 [<ffffffff810cb123>] ? __lock_acquire+0x733/0x1ad0
 [<ffffffff81020f59>] ? sched_clock+0x9/0x10
 [<ffffffff810ccb91>] lock_acquire+0xa1/0x1e0
 [<ffffffff8117431c>] ? might_fault+0x5c/0xb0
 [<ffffffff81174349>] might_fault+0x89/0xb0
 [<ffffffff8117431c>] ? might_fault+0x5c/0xb0
 [<ffffffff811d0966>] filldir+0x76/0xf0
 [<ffffffff811d08f0>] ? sys_ioctl+0xa0/0xa0
 [<ffffffff811e4169>] dcache_readdir+0x69/0x240
 [<ffffffff811d08f0>] ? sys_ioctl+0xa0/0xa0
 [<ffffffff811d08f0>] ? sys_ioctl+0xa0/0xa0
 [<ffffffff811d0c68>] vfs_readdir+0xb8/0xf0
 [<ffffffff811bce09>] ? fget+0x109/0x2e0
 [<ffffffff811bcd41>] ? fget+0x41/0x2e0
 [<ffffffff811d0d9a>] sys_getdents+0x8a/0x100
 [<ffffffff816a6f29>] system_call_fastpath+0x16/0x1b

Comment 1 Dave Jones 2012-02-23 22:31:47 UTC
still being worked on upstream.
https://lkml.org/lkml/2012/2/16/498

Comment 2 Justin M. Forbes 2012-05-11 13:40:14 UTC
This has been committed to 3.4 65ed76010dfed3cb75c863c9052c367a1bacf80a