Re: [SCSI] fix scsi_reap_target() device_del from atomic context

James Bottomley
2005-12-23T15:27:44Z

On Fri, 2005-12-23 at 05:15 -0700, Matthew Wilcox wrote:
> On Thu, Dec 22, 2005 at 10:13:29PM -0800, Andrew Morton wrote:
> > Given that this can run an arbitrary amount of time later on, how do we
> > know that *shost is still live?
>
> If there's still an starget, its parent shost must still be around, no?

Precisely, starget holds a reference to shost. Even if this
put_device(&starget->dev) is the last put, triggering a final put of the
shost, we've stopped referring to it by that point.

There is a potential improvement, in that could be done which is only to
use the workqueue if we're in atomic context. However, I elected to
leave playing with that cleanup until after 2.6.15

There is also the point that I now have two of these allocations of
structures containing a workqueue and a pointer in separate instances.
It does look like this might be an improvement to the API (i.e. a
workqueue use that manages the allocation of the actual work_struct).

James