Re: [RFC] fix our current target reap infrastructure.

2013-12-15 Thread James Bottomley
On Sun, 2013-12-15 at 21:49 -0500, Alan Stern wrote: > On Sun, 15 Dec 2013, James Bottomley wrote: > > > No, I was thinking of the two thread scan bug (i.e. two scan threads) > > not one scan and one remove, which is a bug in the old code. > > By the way, the existing code doesn't allow two threa

Re: [RFC] fix our current target reap infrastructure.

2013-12-15 Thread James Bottomley
On Sun, 2013-12-15 at 21:44 -0500, Alan Stern wrote: > On Sun, 15 Dec 2013, James Bottomley wrote: > > > No, I was thinking of the two thread scan bug (i.e. two scan threads) > > not one scan and one remove, which is a bug in the old code. This is a > > race between put and get when the kref is i

Re: [RFC] fix our current target reap infrastructure.

2013-12-15 Thread Alan Stern
On Sun, 15 Dec 2013, James Bottomley wrote: > No, I was thinking of the two thread scan bug (i.e. two scan threads) > not one scan and one remove, which is a bug in the old code. By the way, the existing code doesn't allow two threads to scan a target at the same time. They would both have to ho

Re: [RFC] fix our current target reap infrastructure.

2013-12-15 Thread Alan Stern
On Sun, 15 Dec 2013, James Bottomley wrote: > No, I was thinking of the two thread scan bug (i.e. two scan threads) > not one scan and one remove, which is a bug in the old code. This is a > race between put and get when the kref is incremented from zero (an > illegal operation which triggers a w

Re: [RFC] fix our current target reap infrastructure.

2013-12-15 Thread James Bottomley
On Sun, 2013-12-15 at 16:32 -0500, Alan Stern wrote: > On Sat, 14 Dec 2013, James Bottomley wrote: > > > > The refcount test and state change race with scsi_alloc_target(). > > > Maybe the race won't occur in practice, but to be safe you should hold > > > shost->host_lock throughout that time in

Re: [RFC] fix our current target reap infrastructure.

2013-12-15 Thread Alan Stern
On Sat, 14 Dec 2013, James Bottomley wrote: > > The refcount test and state change race with scsi_alloc_target(). > > Maybe the race won't occur in practice, but to be safe you should hold > > shost->host_lock throughout that time interval, as the original code > > here does. > > You mean the f

Re: [RFC] fix our current target reap infrastructure.

2013-12-14 Thread James Bottomley
On Fri, 2013-12-13 at 22:32 -0500, Alan Stern wrote: > On Fri, 13 Dec 2013, James Bottomley wrote: > > > This patch eliminates the reap_ref and replaces it with a proper kref. > > On last put of this kref, the target is removed from visibility in > > sysfs. The final call to scsi_target_reap() fo

Re: [RFC] fix our current target reap infrastructure.

2013-12-13 Thread Alan Stern
On Fri, 13 Dec 2013, James Bottomley wrote: > This patch eliminates the reap_ref and replaces it with a proper kref. > On last put of this kref, the target is removed from visibility in > sysfs. The final call to scsi_target_reap() for the device is done from > __scsi_remove_device() and only if

[RFC] fix our current target reap infrastructure.

2013-12-13 Thread James Bottomley
This patch eliminates the reap_ref and replaces it with a proper kref. On last put of this kref, the target is removed from visibility in sysfs. The final call to scsi_target_reap() for the device is done from __scsi_remove_device() and only if the device was made visible. This ensures that the t