Re: Questions about scsi_target_reap and starget/sdev lifecyle

James Bottomley
2005-06-15T23:03:59Z

On Wed, 2005-06-15 at 17:11 -0400, Alan Stern wrote:
> This means that scsi_target_reap can be called and the __targets list
> changed essentially at any time (subject only to the host_lock). Hence it
> is impossible for scsi_forget_host to iterate through the list of targets
> belonging to the host: While it is working to remove one target, the next
> target on the list (stored in the tmp variable) might be removed by
> another thread.

It's no better nor worse than we already have. As has been said many
times before, we need a proper host state model.

> In fact there doesn't seem to be any safe way to remove all the targets
> from a host. And what's to prevent scsi_target_reap being called twice
> for the same target?

The usage, if you look at the code ... it's alloc/reap or inc
reap_ref/reap

James