|
@@ -371,8 +371,7 @@ static void scsicmd_free ( struct refcnt *refcnt ) {
|
371
|
371
|
struct scsi_command *scsicmd =
|
372
|
372
|
container_of ( refcnt, struct scsi_command, refcnt );
|
373
|
373
|
|
374
|
|
- /* Remove from list of commands */
|
375
|
|
- list_del ( &scsicmd->list );
|
|
374
|
+ /* Drop reference to SCSI device */
|
376
|
375
|
scsidev_put ( scsicmd->scsidev );
|
377
|
376
|
|
378
|
377
|
/* Free command */
|
|
@@ -395,6 +394,10 @@ static void scsicmd_close ( struct scsi_command *scsicmd, int rc ) {
|
395
|
394
|
|
396
|
395
|
/* Shut down interfaces */
|
397
|
396
|
intfs_shutdown ( rc, &scsicmd->scsi, &scsicmd->block, NULL );
|
|
397
|
+
|
|
398
|
+ /* Remove from list of commands and drop list's reference */
|
|
399
|
+ list_del ( &scsicmd->list );
|
|
400
|
+ scsicmd_put ( scsicmd );
|
398
|
401
|
}
|
399
|
402
|
|
400
|
403
|
/**
|
|
@@ -733,9 +736,8 @@ static int scsidev_command ( struct scsi_device *scsidev,
|
733
|
736
|
if ( ( rc = scsicmd_command ( scsicmd ) ) != 0 )
|
734
|
737
|
goto err_command;
|
735
|
738
|
|
736
|
|
- /* Attach to parent interface, mortalise self, and return */
|
|
739
|
+ /* Attach to parent interface, transfer reference to list, and return */
|
737
|
740
|
intf_plug_plug ( &scsicmd->block, block );
|
738
|
|
- ref_put ( &scsicmd->refcnt );
|
739
|
741
|
return 0;
|
740
|
742
|
|
741
|
743
|
err_command:
|
|
@@ -843,11 +845,8 @@ static void scsidev_close ( struct scsi_device *scsidev, int rc ) {
|
843
|
845
|
NULL );
|
844
|
846
|
|
845
|
847
|
/* Shut down any remaining commands */
|
846
|
|
- list_for_each_entry_safe ( scsicmd, tmp, &scsidev->cmds, list ) {
|
847
|
|
- scsicmd_get ( scsicmd );
|
|
848
|
+ list_for_each_entry_safe ( scsicmd, tmp, &scsidev->cmds, list )
|
848
|
849
|
scsicmd_close ( scsicmd, rc );
|
849
|
|
- scsicmd_put ( scsicmd );
|
850
|
|
- }
|
851
|
850
|
}
|
852
|
851
|
|
853
|
852
|
/** SCSI device block interface operations */
|