Re: [RFC 0/2] target refcounting infrastructure fixes for usb

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 20 Dec 2013, Sarah Sharp wrote:

> On Thu, Dec 19, 2013 at 11:48:47AM -0800, James Bottomley wrote:
> > It should apply incrementally on top of the previous two.  If it
> > actually works, I'll fold it into the first patch.
> 
> Well, it doesn't oops anymore, but it does generate a pile of warnings:

This was a simple oversight.  scsi_target_reap() was called at the
start of __scsi_remove_device(), but it should be called at the end.
The patch below, applied on top of James's three patches, will fix the
warnings.

Alan Stern

P.S.: The comment isn't entirely correct any more...



Index: usb-3.13/drivers/scsi/scsi_sysfs.c
===================================================================
--- usb-3.13.orig/drivers/scsi/scsi_sysfs.c
+++ usb-3.13/drivers/scsi/scsi_sysfs.c
@@ -1028,13 +1028,6 @@ void __scsi_remove_device(struct scsi_de
 {
 	struct device *dev = &sdev->sdev_gendev;
 
-	/*
-	 * Paired with the kref_get() in scsi_sysfs_initialize().  We're
-	 * removing sysfs visibility from the device, so make the target
-	 * invisible if this was the last device underneath it.
-	 */
-	scsi_target_reap(scsi_target(sdev));
-
 	if (sdev->is_visible) {
 		if (scsi_device_set_state(sdev, SDEV_CANCEL) != 0)
 			return;
@@ -1059,6 +1052,13 @@ void __scsi_remove_device(struct scsi_de
 		sdev->host->hostt->slave_destroy(sdev);
 	transport_destroy_device(dev);
 
+	/*
+	 * Paired with the kref_get() in scsi_sysfs_initialize().  We're
+	 * removing sysfs visibility from the device, so make the target
+	 * invisible if this was the last device underneath it.
+	 */
+	scsi_target_reap(scsi_target(sdev));
+
 	put_device(dev);
 }
 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux