From: Oliver Neukum <oliver@neukum.org>
To: Frederik Deweerdt <deweerdt@free.fr>
Cc: Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, greg@kroah.com, maneesh@in.ibm.com,
oliver@neukum.name
Subject: Re: [-mm patch] lockdep: possible deadlock in sysfs
Date: Fri, 5 Jan 2007 16:13:25 +0100 [thread overview]
Message-ID: <200701051613.25882.oliver@neukum.org> (raw)
In-Reply-To: <20070105121643.GE17863@slug>
Am Freitag, 5. Januar 2007 13:16 schrieb Frederik Deweerdt:
> On Thu, Jan 04, 2007 at 10:02:00PM -0800, Andrew Morton wrote:
> >
> > ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.20-rc3/2.6.20-rc3-mm1/
> >
> Hi,
>
> Lockdep issues the following warning:
> [ 9.064000] =============================================
> [ 9.064000] [ INFO: possible recursive locking detected ]
> [ 9.064000] 2.6.20-rc3-mm1 #3
> [ 9.064000] ---------------------------------------------
> [ 9.064000] init/1 is trying to acquire lock:
> [ 9.064000] (&sysfs_inode_imutex_key){--..}, at: [<c03e6afc>] mutex_lock+0x1c/0x1f
> [ 9.064000]
> [ 9.064000] but task is already holding lock:
> [ 9.064000] (&sysfs_inode_imutex_key){--..}, at: [<c03e6afc>] mutex_lock+0x1c/0x1f
> [ 9.065000]
> [ 9.065000] other info that might help us debug this:
> [ 9.065000] 2 locks held by init/1:
> [ 9.065000] #0: (tty_mutex){--..}, at: [<c03e6afc>] mutex_lock+0x1c/0x1f
> [ 9.065000] #1: (&sysfs_inode_imutex_key){--..}, at: [<c03e6afc>] mutex_lock+0x1c/0x1f
> [ 9.065000]
> [ 9.065000] stack backtrace:
> [ 9.065000] [<c010390d>] show_trace_log_lvl+0x1a/0x30
> [ 9.066000] [<c0103935>] show_trace+0x12/0x14
> [ 9.066000] [<c0103a2f>] dump_stack+0x16/0x18
> [ 9.066000] [<c0138cb8>] print_deadlock_bug+0xb9/0xc3
> [ 9.066000] [<c0138d17>] check_deadlock+0x55/0x5a
> [ 9.066000] [<c013a953>] __lock_acquire+0x371/0xbf0
> [ 9.066000] [<c013b7a9>] lock_acquire+0x69/0x83
> [ 9.066000] [<c03e6b7e>] __mutex_lock_slowpath+0x75/0x2d1
> [ 9.066000] [<c03e6afc>] mutex_lock+0x1c/0x1f
> [ 9.066000] [<c01b249c>] sysfs_drop_dentry+0xb1/0x133
> [ 9.066000] [<c01b25d1>] sysfs_hash_and_remove+0xb3/0x142
> [ 9.066000] [<c01b30ed>] sysfs_remove_file+0xd/0x10
> [ 9.067000] [<c02849e0>] device_remove_file+0x23/0x2e
> [ 9.067000] [<c02850b2>] device_del+0x188/0x1e6
> [ 9.067000] [<c028511b>] device_unregister+0xb/0x15
> [ 9.067000] [<c0285318>] device_destroy+0x9c/0xa9
> [ 9.067000] [<c0261431>] vcs_remove_sysfs+0x1c/0x3b
> [ 9.067000] [<c0267a08>] con_close+0x5e/0x6b
> [ 9.067000] [<c02598f2>] release_dev+0x4c4/0x6e5
> [ 9.067000] [<c0259faa>] tty_release+0x12/0x1c
> [ 9.067000] [<c0174872>] __fput+0x177/0x1a0
> [ 9.067000] [<c01746f5>] fput+0x3b/0x41
> [ 9.068000] [<c0172ee1>] filp_close+0x36/0x65
> [ 9.068000] [<c0172f73>] sys_close+0x63/0xa4
> [ 9.068000] [<c0102a96>] sysenter_past_esp+0x5f/0x99
> [ 9.068000] =======================
>
> This is due to sysfs_hash_and_remove() holding dir->d_inode->i_mutex
> before calling sysfs_drop_dentry() which calls orphan_all_buffers()
> which in turn takes node->i_mutex.
> The following patch solves the problem by defering the buffers orphaning
> after the dir->d_inode->imutex is released. Not sure it's the best
> solution though, better wait for feedback from Maneesh and Oliver.
Hi,
are you sure there's a code path that takes these locks in the reverse order?
I've looked through the code twice and not found any. It doesn't make much
sense to first lock the file and afterwards the directory.
Regarding your patch, it should work, but I don't see the need for it.
Regards
Oliver
next prev parent reply other threads:[~2007-01-05 15:13 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-01-05 6:02 2.6.20-rc3-mm1 Andrew Morton
2007-01-05 9:44 ` [-mm patch] lockdep: unbalance at generic_sync_sb_inodes Frederik Deweerdt
2007-01-05 12:16 ` [-mm patch] lockdep: possible deadlock in sysfs Frederik Deweerdt
2007-01-05 12:48 ` Oliver Neukum
2007-01-05 15:13 ` Oliver Neukum [this message]
2007-01-05 16:42 ` Frederik Deweerdt
2007-01-05 16:53 ` Oliver Neukum
2007-01-05 16:23 ` 2.6.20-rc3-mm1 Mariusz Kozlowski
2007-01-05 16:23 ` 2.6.20-rc3-mm1 Mariusz Kozlowski
2007-01-05 18:45 ` 2.6.20-rc3-mm1 Tim Schmielau
2007-01-05 18:45 ` 2.6.20-rc3-mm1 Tim Schmielau
2007-01-08 12:36 ` 2.6.20-rc3-mm1 Mariusz Kozlowski
2007-01-08 12:36 ` 2.6.20-rc3-mm1 Mariusz Kozlowski
2007-01-05 20:55 ` 2.6.20-rc3-mm1 Benjamin Herrenschmidt
2007-01-05 21:15 ` 2.6.20-rc3-mm1 Andrew Morton
2007-01-05 21:15 ` 2.6.20-rc3-mm1 Andrew Morton
2007-01-05 21:24 ` 2.6.20-rc3-mm1 Benjamin Herrenschmidt
2007-01-05 21:24 ` 2.6.20-rc3-mm1 Benjamin Herrenschmidt
2007-01-08 19:32 ` 2.6.20-rc3-mm1 Cornelia Huck
2007-01-08 19:32 ` 2.6.20-rc3-mm1 Cornelia Huck
2007-01-08 21:19 ` 2.6.20-rc3-mm1 Benjamin Herrenschmidt
2007-01-08 21:19 ` 2.6.20-rc3-mm1 Benjamin Herrenschmidt
2007-01-06 1:07 ` [-mm patch] make proc_dointvec_taint() static Adrian Bunk
2007-01-06 10:58 ` 2.6.20-rc3-mm1: umount reiser4 FS stuck in D state Laurent Riffard
2007-01-06 14:12 ` Laurent Riffard
2007-01-06 16:37 ` Jens Axboe
2007-01-06 18:58 ` Vladimir V. Saveliev
2007-01-12 22:56 ` Laurent Riffard
2007-01-23 16:40 ` Vladimir V. Saveliev
2007-01-23 15:46 ` Jens Axboe
2007-01-23 18:21 ` Laurent Riffard
2007-02-01 20:04 ` Edward Shishkin
2007-02-01 20:42 ` Laurent Riffard
2007-02-01 21:52 ` Edward Shishkin
2007-02-02 21:13 ` Laurent Riffard
2007-01-06 12:55 ` 2.6.20-rc3-mm1 - git-block.patch causes hard lockups Valdis.Kletnieks
2007-01-08 8:55 ` Jens Axboe
2007-01-09 18:03 ` Valdis.Kletnieks
2007-01-06 13:44 ` 2.6.20-rc3-mm1 - rewrite-lock-in-cpufreq-to-eliminate-cpufreq-hotplug-related-issues.patch Valdis.Kletnieks
2007-01-06 16:59 ` Mattia Dongili
2007-01-07 0:29 ` Valdis.Kletnieks
2007-01-06 15:20 ` 2.6.20-rc3-mm1 - reiser4-sb_sync_inodes.patch causes boot hang Valdis.Kletnieks
2007-01-06 19:14 ` Andrew Morton
2007-01-07 0:28 ` Valdis.Kletnieks
2007-01-09 14:40 ` [Re: 2.6.20-rc3-mm1] BUG: at kernel/sched.c:3415 sub_preempt_count() Maciej Rutecki
2007-01-09 15:28 ` Frederik Deweerdt
2007-01-09 20:50 ` Maciej Rutecki
2007-01-09 21:06 ` Frederik Deweerdt
2007-01-10 16:54 ` Maciej Rutecki
2007-01-11 18:28 ` [-mm patch] remove tcp header from tcp_v4_check Frederik Deweerdt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200701051613.25882.oliver@neukum.org \
--to=oliver@neukum.org \
--cc=akpm@osdl.org \
--cc=deweerdt@free.fr \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=maneesh@in.ibm.com \
--cc=oliver@neukum.name \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.