Re: [Bug #15202] lockdep warning during elevator_switch

David Rientjes
2010-02-08T00:46:25Z

On Sun, 7 Feb 2010, Hugh Dickins wrote:

> > This message has been generated automatically as a part of a summary report
> > of recent regressions.
> >
> > The following bug entry is on the current list of known regressions
> > from 2.6.32. Please verify if it still should be listed and let the tracking team
> > know (either way).
> >
> >
> > Bug-Entry : http://bugzilla.kernel.org/show_bug.cgi?id=15202
> > Subject : lockdep warning during elevator_switch
> > Submitter : Hugh Dickins <hugh.dickins@tiscali.co.uk>
> > Date : 2010-01-31 23:55 (8 days old)
> > References : http://marc.info/?l=linux-kernel&m=126498212613051&w=4
>
> Yes, still so in 2.6.33-rc7.
>

This type of lock dependency is always going to exist whenever a write to
a sysfs file causes the kernel to remove its dirent. In this case,
writing to /sys/devices/block/xxx/queue/scheduler takes sd->dep_map and
sd->parent->dep_map via sysfs_get_active_two() to pin both via
sysfs_write_file(). The call to kobject_del() removes its directory
from the hierarchy which takes sd->dep_map in sysfs_deactivate() because
of 846f99749a. Eric, do we need to preempt the rwsem from being acquired
here when the dirent is already pinned because of a store to one of its
files?