Re: kernfs/rtc: circular dependency between kernfs and ops_lock
From: Tejun Heo
Date: Sat Feb 22 2014 - 15:52:29 EST
Hello,
On Sat, Feb 22, 2014 at 12:51:42PM -0500, Sasha Levin wrote:
> While fuzzing with trinity inside a KVM tools guest running the
> latest -next kernel I've stumbled on the following (now with pretty
> line numbers!) spew:
Heh, that's pretty awesome.
> [ 218.132898] ======================================================
> [ 218.133902] [ INFO: possible circular locking dependency detected ]
> [ 218.134820] 3.14.0-rc3-next-20140221-sasha-00008-g0e660cf-dirty #116 Tainted: G W
> [ 218.135911] -------------------------------------------------------
> [ 218.136842] trinity-c47/11528 is trying to acquire lock:
> [ 218.137613] (&rtc->ops_lock){+.+.+.}, at: [<drivers/rtc/interface.c:42>] rtc_read_time+0x2b/0x60
> [ 218.138909]
> [ 218.138909] but task is already holding lock:
> [ 218.139802] (s_active#20){++++.+}, at: [<fs/kernfs/file.c:99>] kernfs_seq_start+0x34/0xa0
> [ 218.140087]
> [ 218.140087] which lock already depends on the new lock.
The problem is rtc_device_unregister(). It grabs rtc->ops_lock and
then tries to remove the sysfs files. Some of those sysfs file
implementations acquire rtc->ops_lock, so it of course can lead to
deadlocks. One can't try to delete a sysfs file which acquires a lock
while holding the same lock.
Thanks.
--
tejun
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/