bad refcount of the sdev when using scsi_device_add

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

 



Hi, 
            My driver calles scsi_add_device for adding single scsi device, and the following flow for removing device:
            sdev = scsi_device_lookup(host, 0, target, 0);
            if (sdev != NULL)
            {
            //    scsi_device_cancel(sdev, 0);
                scsi_remove_device(sdev);
                scsi_device_put(sdev);
            }


            But I see that after doing several hotplugs for the scsi device, the scsi device entry under /sys/bus/scsi/devices will remain even if the hotplug ends with unconnected device.
            Adding and removing single device using echo “add/remove ….” > /proc/scsi/scsi works fine.
            I found that the flow of adding device using scsi_scan_target ends with different refcount of the sdev than using the scsi_add_device, in the former one the refcount is less by 1. the scsi_scan_target calls scsi_device_put, but there is no analogous put in the scsi_add_device function. Now, when I add scsi_device_put after scsi_add_device, the issue get fixed.

 Is it a bug in the scsi_device_add? Is there any problem with my workaround?
            
            
Saeed Bishara

-
: 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