Re: Lockdep false positive in sysfs

From: Tejun Heo
Date: Thu Apr 26 2012 - 18:18:00 EST


On Thu, Apr 26, 2012 at 02:14:30PM -0400, Alan Stern wrote:
> > > Hmmm.... This happens because, by default, sysfs_dirents for the same
> > > attr share the same lockdep key. This happens from
> > > sysfs_dirent_init_lockdep(). Hmm.... we can,
> > >
> > > * Somehow assign different keys to sysfs_dirents for the specific
> > > attr. Use array of attrs indexed by bus depth?
> >
> > Possible with sysfs_attr_init but pretty ugly. Especially since it
> > sounds like this is a situation that does not presuppose a maximum
> > depth. I do remember that the lockdep keys must be statically allocated
> > which makes this a challenge.

The depth is limited by USB spec.

> I agree; this doesn't seem like a good approach.

It sure isn't pretty but probably best matches the situation in the
sense that lockdep would actually be able to know about the nesting
going on.

> Another idea is to have A's method temporarily drop the sysfs readlock.
> Of course that would put the onus on the USB core of guaranteeing that
> A cannot be removed while this happens, but we can handle that.

Yeah, that's an easier way out. Please make it a proper sysfs API
call tho so that people working on sysfs later can know of the special
case.

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/