Bug 13598 - FIEMAP related circular locking dependency detected
Summary: FIEMAP related circular locking dependency detected
Status: RESOLVED CODE_FIX
Alias: None
Product: File System
Classification: Unclassified
Component: ext4 (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Eric Sandeen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-22 09:01 UTC by Aneesh Kumar K.V
Modified: 2010-03-08 18:20 UTC (History)
1 user (show)

See Also:
Kernel Version:
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Aneesh Kumar K.V 2009-06-22 09:01:54 UTC
Have a bugzilla entry for tracking the problem.

reported here http://article.gmane.org/gmane.comp.file-systems.ext4/13076

[ INFO: possible circular locking dependency detected ]
2.6.30-rc4-autokern1 #1
-------------------------------------------------------
a.out/5595 is trying to acquire lock:
 (&mm->mmap_sem){++++++}, at: [<c047f023>] might_fault+0x35/0x72

but task is already holding lock:
 (&ei->i_data_sem){++++..}, at: [<c04f2f71>] ext4_fiemap+0x139/0x191

which lock already depends on the new lock.

the existing dependency chain (in reverse order) is:

-> #1 (&ei->i_data_sem){++++..}:
       [<c044817e>] validate_chain+0x89b/0xba1
       [<c0448b28>] __lock_acquire+0x6a4/0x73c
       [<c0449d40>] lock_acquire+0xa8/0xc8
       [<c06a6f91>] down_read+0x1e/0x5b
       [<c04e1a83>] ext4_get_blocks_wrap+0x28/0x27e
       [<c04e2782>] ext4_get_block+0x94/0xc9
       [<c04b3171>] do_mpage_readpage+0x24b/0x5e0
       [<c04b3620>] mpage_readpages+0x74/0xa8
       [<c04e0edc>] ext4_readpages+0x14/0x16
       [<c04732bd>] __do_page_cache_readahead+0x14f/0x1b8
       [<c04736bf>] do_page_cache_readahead+0x42/0x53
       [<c046e57b>] filemap_fault+0x194/0x3ad
       [<c047bea2>] __do_fault+0x3b/0x35c
       [<c047db7b>] handle_mm_fault+0x36d/0x7a9
       [<c06aa208>] do_page_fault+0x28d/0x2f1
       [<c06a8612>] error_code+0x72/0x78
       [<ffffffff>] 0xffffffff

-> #0 (&mm->mmap_sem){++++++}:
       [<c0447eb2>] validate_chain+0x5cf/0xba1
       [<c0448b28>] __lock_acquire+0x6a4/0x73c
       [<c0449d40>] lock_acquire+0xa8/0xc8
       [<c047f040>] might_fault+0x52/0x72
       [<c0548f7d>] copy_to_user+0x28/0x3f
       [<c049bd9b>] fiemap_fill_next_extent+0x9e/0xc9
       [<c04f2aef>] ext4_ext_fiemap_cb+0x1a7/0x1c1
       [<c04f1cdd>] ext4_ext_walk_space+0x194/0x207
       [<c04f2fb4>] ext4_fiemap+0x17c/0x191
       [<c049c157>] do_vfs_ioctl+0x32a/0x4a6
       [<c049c313>] sys_ioctl+0x40/0x5a
       [<c0402944>] sysenter_do_call+0x12/0x32
       [<ffffffff>] 0xffffffff

other info that might help us debug this:

1 lock held by a.out/5595:
 #0:  (&ei->i_data_sem){++++..}, at: [<c04f2f71>] ext4_fiemap+0x139/0x191

stack backtrace:
Pid: 5595, comm: a.out Not tainted 2.6.30-rc4-autokern1 #1
Call Trace:
 [<c04477e0>] print_circular_bug_tail+0xab/0xb6
 [<c0447eb2>] validate_chain+0x5cf/0xba1
 [<c0448b28>] __lock_acquire+0x6a4/0x73c
 [<c0449d40>] lock_acquire+0xa8/0xc8
 [<c047f023>] ? might_fault+0x35/0x72
 [<c047f040>] might_fault+0x52/0x72
 [<c047f023>] ? might_fault+0x35/0x72
 [<c0548f7d>] copy_to_user+0x28/0x3f
 [<c049bd9b>] fiemap_fill_next_extent+0x9e/0xc9
 [<c04f2aef>] ext4_ext_fiemap_cb+0x1a7/0x1c1
 [<c04f1cdd>] ext4_ext_walk_space+0x194/0x207
 [<c04f2fb4>] ext4_fiemap+0x17c/0x191
 [<c04f2948>] ? ext4_ext_fiemap_cb+0x0/0x1c1
 [<c049c157>] do_vfs_ioctl+0x32a/0x4a6
 [<c049c313>] sys_ioctl+0x40/0x5a
 [<c0402944>] sysenter_do_call+0x12/0x32
--
Comment 1 Eric Sandeen 2010-03-08 18:19:17 UTC
Assigning to myself just so I can close it; Aneesh looked and this was fixed by:

From: Theodore Ts'o <tytso@mit.edu>
Date: Thu, 10 Dec 2009 02:30:02 +0000 (-0500)
Subject: ext4: Fix potential fiemap deadlock (mmap_sem vs. i_data_sem)
X-Git-Tag: v2.6.33-rc1~330^2
X-Git-Url: http://git.kernel.org/?p=linux%2Fkernel%2Fgit%2Ftorvalds%2Flinux-2.6.git;a=commitdiff_plain;h=fab3a549e204172236779f502eccb4f9bf0dc87d

ext4: Fix potential fiemap deadlock (mmap_sem vs. i_data_sem)
Comment 2 Eric Sandeen 2010-03-08 18:20:09 UTC
Fixed in 2.6.32.1 and beyond

Note You need to log in before you can comment on or make changes to this bug.