aboutsummaryrefslogtreecommitdiffstats
path: root/include/scsi
diff options
context:
space:
mode:
authorJames Bottomley <JBottomley@Parallels.com>2014-01-21 10:00:50 -0500
committerJames Bottomley <JBottomley@Parallels.com>2014-03-15 13:18:59 -0400
commite63ed0d7a98014fdfc2cfeb3f6dada313dcabb59 (patch)
tree64f3dd3c794d009538993445d8039f04407dc593 /include/scsi
parent81b86d4d275244ad7e134e95cbcfee49198da854 (diff)
[SCSI] fix our current target reap infrastructure
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 target disappears as soon as the last device is gone rather than waiting until final release of the device (which is often too long). Reviewed-by: Alan Stern <stern@rowland.harvard.edu> Tested-by: Sarah Sharp <sarah.a.sharp@linux.intel.com> Cc: stable@vger.kernel.org # delay backport by 2 months for field testing Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'include/scsi')
-rw-r--r--include/scsi/scsi_device.h3
1 files changed, 1 insertions, 2 deletions
diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
index 622e100561d2..ccabdc1c27ca 100644
--- a/include/scsi/scsi_device.h
+++ b/include/scsi/scsi_device.h
@@ -269,7 +269,7 @@ struct scsi_target {
269 struct list_head siblings; 269 struct list_head siblings;
270 struct list_head devices; 270 struct list_head devices;
271 struct device dev; 271 struct device dev;
272 unsigned int reap_ref; /* protected by the host lock */ 272 struct kref reap_ref; /* last put renders target invisible */
273 unsigned int channel; 273 unsigned int channel;
274 unsigned int id; /* target id ... replace 274 unsigned int id; /* target id ... replace
275 * scsi_device.id eventually */ 275 * scsi_device.id eventually */
@@ -296,7 +296,6 @@ struct scsi_target {
296#define SCSI_DEFAULT_TARGET_BLOCKED 3 296#define SCSI_DEFAULT_TARGET_BLOCKED 3
297 297
298 char scsi_level; 298 char scsi_level;
299 struct execute_work ew;
300 enum scsi_target_state state; 299 enum scsi_target_state state;
301 void *hostdata; /* available to low-level driver */ 300 void *hostdata; /* available to low-level driver */
302 unsigned long starget_data[0]; /* for the transport */ 301 unsigned long starget_data[0]; /* for the transport */