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