lkml.org 
[lkml]   [2014]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: kernfs/rtc: circular dependency between kernfs and ops_lock
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


\
 
 \ /
  Last update: 2014-02-22 22:41    [W:0.092 / U:0.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site