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

Alan Stern
2009-05-28T21:05:15Z

On Thu, 28 May 2009, James Bottomley wrote:

> > How so? Why not unlink the target from the host's list when the
> > device_del() call returns? A new target can be created any time after
> > that, since the old one is now completely invisible.
>
> The answer to that one is several emails back: we need the target in the
> host list for the lifetime of the devices ... it's alterable, but even
> more auditing.

I don't recall you mentioning that the target had to be linked into the
host's list for the lifetime of the devices; I thought you said merely
that the target had to _exist_ for the lifetime of the devices.

Does it really need to be linked, or is existence of the structure
sufficient?

Likewise, after a device is removed from visibility, does it need to
remain linked into the host's and target's lists?

> > P.S.: Does scsi_target_reap() really ever get called in non-process
> > context? I couldn't find any place where that might happen.
>
> From the device release, which is done by last put, which could be I/O
> context.

But scsi_target_reap() isn't called directly from the device release.
It's called from scsi_device_dev_release_usercontext().

And besides, in the patch I'm working on it isn't called from either of
those places -- it's called from __scsi_remove_device(). So I'll go
ahead and get rid of scsi_target_reap_usercontext().

Alan Stern