@@ -1996,6 +1996,11 @@ qla2x00_tmf_iocb_timeout(void *data)
1996
1996
int rc , h ;
1997
1997
unsigned long flags ;
1998
1998
1999
+ if (sp -> type == SRB_MARKER ) {
2000
+ complete (& tmf -> u .tmf .comp );
2001
+ return ;
2002
+ }
2003
+
1999
2004
rc = qla24xx_async_abort_cmd (sp , false);
2000
2005
if (rc ) {
2001
2006
spin_lock_irqsave (sp -> qpair -> qp_lock_ptr , flags );
@@ -2023,6 +2028,7 @@ static void qla_marker_sp_done(srb_t *sp, int res)
2023
2028
sp -> handle , sp -> fcport -> d_id .b24 , sp -> u .iocb_cmd .u .tmf .flags ,
2024
2029
sp -> u .iocb_cmd .u .tmf .lun , sp -> qpair -> id );
2025
2030
2031
+ sp -> u .iocb_cmd .u .tmf .data = res ;
2026
2032
complete (& tmf -> u .tmf .comp );
2027
2033
}
2028
2034
@@ -2039,6 +2045,11 @@ static void qla_marker_sp_done(srb_t *sp, int res)
2039
2045
} while (cnt); \
2040
2046
}
2041
2047
2048
+ /**
2049
+ * qla26xx_marker: send marker IOCB and wait for the completion of it.
2050
+ * @arg: pointer to argument list.
2051
+ * It is assume caller will provide an fcport pointer and modifier
2052
+ */
2042
2053
static int
2043
2054
qla26xx_marker (struct tmf_arg * arg )
2044
2055
{
@@ -2048,6 +2059,14 @@ qla26xx_marker(struct tmf_arg *arg)
2048
2059
int rval = QLA_FUNCTION_FAILED ;
2049
2060
fc_port_t * fcport = arg -> fcport ;
2050
2061
2062
+ if (TMF_NOT_READY (arg -> fcport )) {
2063
+ ql_dbg (ql_dbg_taskm , vha , 0x8039 ,
2064
+ "FC port not ready for marker loop-id=%x portid=%06x modifier=%x lun=%lld qp=%d.\n" ,
2065
+ fcport -> loop_id , fcport -> d_id .b24 ,
2066
+ arg -> modifier , arg -> lun , arg -> qpair -> id );
2067
+ return QLA_SUSPENDED ;
2068
+ }
2069
+
2051
2070
/* ref: INIT */
2052
2071
sp = qla2xxx_get_qpair_sp (vha , arg -> qpair , fcport , GFP_KERNEL );
2053
2072
if (!sp )
@@ -2074,11 +2093,19 @@ qla26xx_marker(struct tmf_arg *arg)
2074
2093
2075
2094
if (rval != QLA_SUCCESS ) {
2076
2095
ql_log (ql_log_warn , vha , 0x8031 ,
2077
- "Marker IOCB failed (%x).\n" , rval );
2096
+ "Marker IOCB send failure (%x).\n" , rval );
2078
2097
goto done_free_sp ;
2079
2098
}
2080
2099
2081
2100
wait_for_completion (& tm_iocb -> u .tmf .comp );
2101
+ rval = tm_iocb -> u .tmf .data ;
2102
+
2103
+ if (rval != QLA_SUCCESS ) {
2104
+ ql_log (ql_log_warn , vha , 0x8019 ,
2105
+ "Marker failed hdl=%x loop-id=%x portid=%06x modifier=%x lun=%lld qp=%d rval %d.\n" ,
2106
+ sp -> handle , fcport -> loop_id , fcport -> d_id .b24 ,
2107
+ arg -> modifier , arg -> lun , sp -> qpair -> id , rval );
2108
+ }
2082
2109
2083
2110
done_free_sp :
2084
2111
/* ref: INIT */
@@ -2091,6 +2118,8 @@ static void qla2x00_tmf_sp_done(srb_t *sp, int res)
2091
2118
{
2092
2119
struct srb_iocb * tmf = & sp -> u .iocb_cmd ;
2093
2120
2121
+ if (res )
2122
+ tmf -> u .tmf .data = res ;
2094
2123
complete (& tmf -> u .tmf .comp );
2095
2124
}
2096
2125
@@ -2104,6 +2133,14 @@ __qla2x00_async_tm_cmd(struct tmf_arg *arg)
2104
2133
2105
2134
fc_port_t * fcport = arg -> fcport ;
2106
2135
2136
+ if (TMF_NOT_READY (arg -> fcport )) {
2137
+ ql_dbg (ql_dbg_taskm , vha , 0x8032 ,
2138
+ "FC port not ready for TM command loop-id=%x portid=%06x modifier=%x lun=%lld qp=%d.\n" ,
2139
+ fcport -> loop_id , fcport -> d_id .b24 ,
2140
+ arg -> modifier , arg -> lun , arg -> qpair -> id );
2141
+ return QLA_SUSPENDED ;
2142
+ }
2143
+
2107
2144
/* ref: INIT */
2108
2145
sp = qla2xxx_get_qpair_sp (vha , arg -> qpair , fcport , GFP_KERNEL );
2109
2146
if (!sp )
@@ -2178,7 +2215,9 @@ int qla_get_tmf(fc_port_t *fcport)
2178
2215
msleep (1 );
2179
2216
2180
2217
spin_lock_irqsave (& ha -> tgt .sess_lock , flags );
2181
- if (fcport -> deleted ) {
2218
+ if (TMF_NOT_READY (fcport )) {
2219
+ ql_log (ql_log_warn , vha , 0x802c ,
2220
+ "Unable to acquire TM resource due to disruption.\n" );
2182
2221
rc = EIO ;
2183
2222
break ;
2184
2223
}
@@ -2204,7 +2243,10 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint64_t lun,
2204
2243
struct scsi_qla_host * vha = fcport -> vha ;
2205
2244
struct qla_qpair * qpair ;
2206
2245
struct tmf_arg a ;
2207
- int i , rval ;
2246
+ int i , rval = QLA_SUCCESS ;
2247
+
2248
+ if (TMF_NOT_READY (fcport ))
2249
+ return QLA_SUSPENDED ;
2208
2250
2209
2251
a .vha = fcport -> vha ;
2210
2252
a .fcport = fcport ;
@@ -2223,6 +2265,14 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint64_t lun,
2223
2265
qpair = vha -> hw -> queue_pair_map [i ];
2224
2266
if (!qpair )
2225
2267
continue ;
2268
+
2269
+ if (TMF_NOT_READY (fcport )) {
2270
+ ql_log (ql_log_warn , vha , 0x8026 ,
2271
+ "Unable to send TM due to disruption.\n" );
2272
+ rval = QLA_SUSPENDED ;
2273
+ break ;
2274
+ }
2275
+
2226
2276
a .qpair = qpair ;
2227
2277
a .flags = flags |TCF_NOTMCMD_TO_TARGET ;
2228
2278
rval = __qla2x00_async_tm_cmd (& a );
@@ -2231,10 +2281,14 @@ qla2x00_async_tm_cmd(fc_port_t *fcport, uint32_t flags, uint64_t lun,
2231
2281
}
2232
2282
}
2233
2283
2284
+ if (rval )
2285
+ goto bailout ;
2286
+
2234
2287
a .qpair = vha -> hw -> base_qpair ;
2235
2288
a .flags = flags ;
2236
2289
rval = __qla2x00_async_tm_cmd (& a );
2237
2290
2291
+ bailout :
2238
2292
if (a .modifier == MK_SYNC_ID_LUN )
2239
2293
qla_put_tmf (fcport );
2240
2294
0 commit comments