Re: [PATCH 25/20] sysfs: Only support removing emtpy sysfs directories.

Alan Stern
2009-05-25T20:14:04Z

On Mon, 25 May 2009, Kay Sievers wrote:

> On Mon, 2009-05-25 at 11:49 -0400, Alan Stern wrote:
> > Since this appears to be a bug in the SCSI layer, let's add some SCSI
> > people to the CC: list.
> >
> > To summarize the problem: The SCSI core tries to unregister a host
> > while its sysfs directory is still non-empty because the target hasn't
> > been unregistered yet.
>
> > Can you provide more of the context? I'd like to see the log starting
> > from when these devices were first registered.
>
> I was able to trigger it with a USB storage device only, connected to a
> hub, and I removed the hub from the host.

Okay, it's a long log dump, but useful. Evidently the problem is
caused by the fact that scsi_target_reap() is called by
scsi_device_dev_release_usercontext() instead of by
__scsi_remove_device() (both functions in drivers/scsi/scsi_sysfs.c).

There's probably a reason for this, but I don't know what it is. Maybe
James can explain.

Alan Stern