Skip to content

Commit 856e152

Browse files
mwilckmartinkpetersen
authored andcommitted
scsi: qla2xxx: set UNLOADING before waiting for session deletion
The purpose of the UNLOADING flag is to avoid port login procedures to continue when a controller is in the process of shutting down. It makes sense to set this flag before starting session teardown. Furthermore, use atomic test_and_set_bit() to avoid the shutdown being run multiple times in parallel. In qla2x00_disable_board_on_pci_error(), the test for UNLOADING is postponed until after the check for an already disabled PCI board. Link: https://lore.kernel.org/r/[email protected] Fixes: 4523502 ("scsi: qla2xxx: Fix driver unload by shutting down chip") Reviewed-by: Arun Easi <[email protected]> Reviewed-by: Daniel Wagner <[email protected]> Reviewed-by: Roman Bolshakov <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Martin Wilck <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 6cbb7ae commit 856e152

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

drivers/scsi/qla2xxx/qla_os.c

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3732,6 +3732,13 @@ qla2x00_remove_one(struct pci_dev *pdev)
37323732
}
37333733
qla2x00_wait_for_hba_ready(base_vha);
37343734

3735+
/*
3736+
* if UNLOADING flag is already set, then continue unload,
3737+
* where it was set first.
3738+
*/
3739+
if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags))
3740+
return;
3741+
37353742
if (IS_QLA25XX(ha) || IS_QLA2031(ha) || IS_QLA27XX(ha) ||
37363743
IS_QLA28XX(ha)) {
37373744
if (ha->flags.fw_started)
@@ -3750,15 +3757,6 @@ qla2x00_remove_one(struct pci_dev *pdev)
37503757

37513758
qla2x00_wait_for_sess_deletion(base_vha);
37523759

3753-
/*
3754-
* if UNLOAD flag is already set, then continue unload,
3755-
* where it was set first.
3756-
*/
3757-
if (test_bit(UNLOADING, &base_vha->dpc_flags))
3758-
return;
3759-
3760-
set_bit(UNLOADING, &base_vha->dpc_flags);
3761-
37623760
qla_nvme_delete(base_vha);
37633761

37643762
dma_free_coherent(&ha->pdev->dev,
@@ -6628,13 +6626,6 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work)
66286626
struct pci_dev *pdev = ha->pdev;
66296627
scsi_qla_host_t *base_vha = pci_get_drvdata(ha->pdev);
66306628

6631-
/*
6632-
* if UNLOAD flag is already set, then continue unload,
6633-
* where it was set first.
6634-
*/
6635-
if (test_bit(UNLOADING, &base_vha->dpc_flags))
6636-
return;
6637-
66386629
ql_log(ql_log_warn, base_vha, 0x015b,
66396630
"Disabling adapter.\n");
66406631

@@ -6645,9 +6636,14 @@ qla2x00_disable_board_on_pci_error(struct work_struct *work)
66456636
return;
66466637
}
66476638

6648-
qla2x00_wait_for_sess_deletion(base_vha);
6639+
/*
6640+
* if UNLOADING flag is already set, then continue unload,
6641+
* where it was set first.
6642+
*/
6643+
if (test_and_set_bit(UNLOADING, &base_vha->dpc_flags))
6644+
return;
66496645

6650-
set_bit(UNLOADING, &base_vha->dpc_flags);
6646+
qla2x00_wait_for_sess_deletion(base_vha);
66516647

66526648
qla2x00_delete_all_vps(ha, base_vha);
66536649

0 commit comments

Comments
 (0)