@@ -707,6 +707,11 @@ qla2xxx_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *cmd)
707707 srb_t * sp ;
708708 int rval ;
709709
710+ if (unlikely (test_bit (UNLOADING , & base_vha -> dpc_flags ))) {
711+ cmd -> result = DID_NO_CONNECT << 16 ;
712+ goto qc24_fail_command ;
713+ }
714+
710715 if (ha -> flags .eeh_busy ) {
711716 if (ha -> flags .pci_channel_io_perm_failure ) {
712717 ql_dbg (ql_dbg_aer , vha , 0x9010 ,
@@ -1451,6 +1456,15 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
14511456 for (cnt = 1 ; cnt < req -> num_outstanding_cmds ; cnt ++ ) {
14521457 sp = req -> outstanding_cmds [cnt ];
14531458 if (sp ) {
1459+ /* Get a reference to the sp and drop the lock.
1460+ * The reference ensures this sp->done() call
1461+ * - and not the call in qla2xxx_eh_abort() -
1462+ * ends the SCSI command (with result 'res').
1463+ */
1464+ sp_get (sp );
1465+ spin_unlock_irqrestore (& ha -> hardware_lock , flags );
1466+ qla2xxx_eh_abort (GET_CMD_SP (sp ));
1467+ spin_lock_irqsave (& ha -> hardware_lock , flags );
14541468 req -> outstanding_cmds [cnt ] = NULL ;
14551469 sp -> done (vha , sp , res );
14561470 }
@@ -2341,6 +2355,8 @@ qla2xxx_scan_finished(struct Scsi_Host *shost, unsigned long time)
23412355{
23422356 scsi_qla_host_t * vha = shost_priv (shost );
23432357
2358+ if (test_bit (UNLOADING , & vha -> dpc_flags ))
2359+ return 1 ;
23442360 if (!vha -> host )
23452361 return 1 ;
23462362 if (time > vha -> hw -> loop_reset_delay * HZ )
0 commit comments