@@ -1894,18 +1894,24 @@ int bnx2fc_queuecommand(struct Scsi_Host *host,
1894
1894
goto exit_qcmd ;
1895
1895
}
1896
1896
}
1897
+
1898
+ spin_lock_bh (& tgt -> tgt_lock );
1899
+
1897
1900
io_req = bnx2fc_cmd_alloc (tgt );
1898
1901
if (!io_req ) {
1899
1902
rc = SCSI_MLQUEUE_HOST_BUSY ;
1900
- goto exit_qcmd ;
1903
+ goto exit_qcmd_tgtlock ;
1901
1904
}
1902
1905
io_req -> sc_cmd = sc_cmd ;
1903
1906
1904
1907
if (bnx2fc_post_io_req (tgt , io_req )) {
1905
1908
printk (KERN_ERR PFX "Unable to post io_req\n" );
1906
1909
rc = SCSI_MLQUEUE_HOST_BUSY ;
1907
- goto exit_qcmd ;
1910
+ goto exit_qcmd_tgtlock ;
1908
1911
}
1912
+
1913
+ exit_qcmd_tgtlock :
1914
+ spin_unlock_bh (& tgt -> tgt_lock );
1909
1915
exit_qcmd :
1910
1916
return rc ;
1911
1917
}
@@ -2020,6 +2026,8 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
2020
2026
int task_idx , index ;
2021
2027
u16 xid ;
2022
2028
2029
+ /* bnx2fc_post_io_req() is called with the tgt_lock held */
2030
+
2023
2031
/* Initialize rest of io_req fields */
2024
2032
io_req -> cmd_type = BNX2FC_SCSI_CMD ;
2025
2033
io_req -> port = port ;
@@ -2047,9 +2055,7 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
2047
2055
/* Build buffer descriptor list for firmware from sg list */
2048
2056
if (bnx2fc_build_bd_list_from_sg (io_req )) {
2049
2057
printk (KERN_ERR PFX "BD list creation failed\n" );
2050
- spin_lock_bh (& tgt -> tgt_lock );
2051
2058
kref_put (& io_req -> refcount , bnx2fc_cmd_release );
2052
- spin_unlock_bh (& tgt -> tgt_lock );
2053
2059
return - EAGAIN ;
2054
2060
}
2055
2061
@@ -2061,19 +2067,15 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
2061
2067
task = & (task_page [index ]);
2062
2068
bnx2fc_init_task (io_req , task );
2063
2069
2064
- spin_lock_bh (& tgt -> tgt_lock );
2065
-
2066
2070
if (tgt -> flush_in_prog ) {
2067
2071
printk (KERN_ERR PFX "Flush in progress..Host Busy\n" );
2068
2072
kref_put (& io_req -> refcount , bnx2fc_cmd_release );
2069
- spin_unlock_bh (& tgt -> tgt_lock );
2070
2073
return - EAGAIN ;
2071
2074
}
2072
2075
2073
2076
if (!test_bit (BNX2FC_FLAG_SESSION_READY , & tgt -> flags )) {
2074
2077
printk (KERN_ERR PFX "Session not ready...post_io\n" );
2075
2078
kref_put (& io_req -> refcount , bnx2fc_cmd_release );
2076
- spin_unlock_bh (& tgt -> tgt_lock );
2077
2079
return - EAGAIN ;
2078
2080
}
2079
2081
@@ -2091,6 +2093,5 @@ int bnx2fc_post_io_req(struct bnx2fc_rport *tgt,
2091
2093
2092
2094
/* Ring doorbell */
2093
2095
bnx2fc_ring_doorbell (tgt );
2094
- spin_unlock_bh (& tgt -> tgt_lock );
2095
2096
return 0 ;
2096
2097
}
0 commit comments