Re: [Bug] INFO: task hung in hub_activate

From: Alan Stern
Date: Mon Mar 04 2024 - 13:32:50 EST


On Mon, Mar 04, 2024 at 05:36:19PM +0100, Greg KH wrote:
> On Mon, Mar 04, 2024 at 11:15:24AM -0500, Alan Stern wrote:
> > Third, this must be a generic problem. It will occur any time a sysfs
> > attribute callback tries to lock its device while another process is
> > trying to unregister that device.
> >
> > We faced this sort of problem some years ago when we were worrying
> > about "suicidal" attributes -- ones which would unregister their own
> > devices. I don't remember what the fix was or how it worked. But we
> > need something like it here.
> >
> > Greg and Tejun, any ideas? Is it possible somehow for an attribute file
> > to be removed while its callback is still running?
>
> Yes, it's a pain, and I hate it, but I think SCSI does this somehow for
> one of their attributes. I don't remember how at the moment, and I
> can't look it up (am traveling), but this should be a good hint.

Are you thinking of the sysfs_break_active_protection() and
sysfs_unbreak_active_protection() functions? They seem to be the
appropriate ones to use here.

Alan Stern