]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
scsi: NCR5380: Clear all unissued commands on host reset
authorHannes Reinecke <hare@suse.com>
Thu, 27 Sep 2018 01:17:11 +0000 (11:17 +1000)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 26 Nov 2019 12:16:54 +0000 (13:16 +0100)
BugLink: https://bugs.launchpad.net/bugs/1853915
[ Upstream commit 1aeeeed7f03c576f096eede7b0384f99a98f588c ]

When doing a host reset we should be clearing all outstanding commands, not
just the command triggering the reset.

[mkp: adjusted Hannes' SoB address]

Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de>
Cc: Ondrey Zary <linux@rainbow-software.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/scsi/NCR5380.c

index 5160d6214a36b040aaf5f6b134899350baaea89d..d0bbb2051804828a4362c1c229aee57fb0e9a651 100644 (file)
@@ -2303,7 +2303,7 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)
        spin_lock_irqsave(&hostdata->lock, flags);
 
 #if (NDEBUG & NDEBUG_ANY)
-       scmd_printk(KERN_INFO, cmd, __func__);
+       shost_printk(KERN_INFO, instance, __func__);
 #endif
        NCR5380_dprint(NDEBUG_ANY, instance);
        NCR5380_dprint_phase(NDEBUG_ANY, instance);
@@ -2321,10 +2321,13 @@ static int NCR5380_host_reset(struct scsi_cmnd *cmd)
         * commands!
         */
 
-       if (list_del_cmd(&hostdata->unissued, cmd)) {
+       list_for_each_entry(ncmd, &hostdata->unissued, list) {
+               struct scsi_cmnd *cmd = NCR5380_to_scmd(ncmd);
+
                cmd->result = DID_RESET << 16;
                cmd->scsi_done(cmd);
        }
+       INIT_LIST_HEAD(&hostdata->unissued);
 
        if (hostdata->selecting) {
                hostdata->selecting->result = DID_RESET << 16;