Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 35014
b: refs/heads/master
c: 85b6c72
h: refs/heads/master
v: v3
  • Loading branch information
James Bottomley authored and James Bottomley committed Sep 1, 2006
1 parent 884c373 commit 05d6222
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 86e33a296c2c9ed6eece0bfff4ac776f42040504
refs/heads/master: 85b6c720b0931101c8bcc3a5abdc2b8514b0fb4b
15 changes: 9 additions & 6 deletions trunk/drivers/scsi/scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,14 +851,14 @@ EXPORT_SYMBOL(scsi_track_queue_full);
*/
int scsi_device_get(struct scsi_device *sdev)
{
if (sdev->sdev_state == SDEV_DEL || sdev->sdev_state == SDEV_CANCEL)
if (sdev->sdev_state == SDEV_DEL)
return -ENXIO;
if (!get_device(&sdev->sdev_gendev))
return -ENXIO;
if (!try_module_get(sdev->host->hostt->module)) {
put_device(&sdev->sdev_gendev);
return -ENXIO;
}
/* We can fail this if we're doing SCSI operations
* from module exit (like cache flush) */
try_module_get(sdev->host->hostt->module);

return 0;
}
EXPORT_SYMBOL(scsi_device_get);
Expand All @@ -873,7 +873,10 @@ EXPORT_SYMBOL(scsi_device_get);
*/
void scsi_device_put(struct scsi_device *sdev)
{
module_put(sdev->host->hostt->module);
/* The module refcount will be zero if scsi_device_get()
* was called from a module removal routine */
if (likely(module_refcount(sdev->host->hostt->module) != 0))
module_put(sdev->host->hostt->module);
put_device(&sdev->sdev_gendev);
}
EXPORT_SYMBOL(scsi_device_put);
Expand Down

0 comments on commit 05d6222

Please sign in to comment.