@@ -2161,7 +2161,8 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
2161
2161
nvme_tcp_destroy_io_queues (ctrl , remove );
2162
2162
}
2163
2163
2164
- static void nvme_tcp_reconnect_or_remove (struct nvme_ctrl * ctrl )
2164
+ static void nvme_tcp_reconnect_or_remove (struct nvme_ctrl * ctrl ,
2165
+ int status )
2165
2166
{
2166
2167
enum nvme_ctrl_state state = nvme_ctrl_state (ctrl );
2167
2168
@@ -2171,13 +2172,14 @@ static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
2171
2172
return ;
2172
2173
}
2173
2174
2174
- if (nvmf_should_reconnect (ctrl )) {
2175
+ if (nvmf_should_reconnect (ctrl , status )) {
2175
2176
dev_info (ctrl -> device , "Reconnecting in %d seconds...\n" ,
2176
2177
ctrl -> opts -> reconnect_delay );
2177
2178
queue_delayed_work (nvme_wq , & to_tcp_ctrl (ctrl )-> connect_work ,
2178
2179
ctrl -> opts -> reconnect_delay * HZ );
2179
2180
} else {
2180
- dev_info (ctrl -> device , "Removing controller...\n" );
2181
+ dev_info (ctrl -> device , "Removing controller (%d)...\n" ,
2182
+ status );
2181
2183
nvme_delete_ctrl (ctrl );
2182
2184
}
2183
2185
}
@@ -2258,23 +2260,25 @@ static void nvme_tcp_reconnect_ctrl_work(struct work_struct *work)
2258
2260
struct nvme_tcp_ctrl * tcp_ctrl = container_of (to_delayed_work (work ),
2259
2261
struct nvme_tcp_ctrl , connect_work );
2260
2262
struct nvme_ctrl * ctrl = & tcp_ctrl -> ctrl ;
2263
+ int ret ;
2261
2264
2262
2265
++ ctrl -> nr_reconnects ;
2263
2266
2264
- if (nvme_tcp_setup_ctrl (ctrl , false))
2267
+ ret = nvme_tcp_setup_ctrl (ctrl , false);
2268
+ if (ret )
2265
2269
goto requeue ;
2266
2270
2267
- dev_info (ctrl -> device , "Successfully reconnected (%d attempt )\n" ,
2268
- ctrl -> nr_reconnects );
2271
+ dev_info (ctrl -> device , "Successfully reconnected (attempt %d/%d )\n" ,
2272
+ ctrl -> nr_reconnects , ctrl -> opts -> max_reconnects );
2269
2273
2270
2274
ctrl -> nr_reconnects = 0 ;
2271
2275
2272
2276
return ;
2273
2277
2274
2278
requeue :
2275
- dev_info (ctrl -> device , "Failed reconnect attempt %d\n" ,
2276
- ctrl -> nr_reconnects );
2277
- nvme_tcp_reconnect_or_remove (ctrl );
2279
+ dev_info (ctrl -> device , "Failed reconnect attempt %d/%d \n" ,
2280
+ ctrl -> nr_reconnects , ctrl -> opts -> max_reconnects );
2281
+ nvme_tcp_reconnect_or_remove (ctrl , ret );
2278
2282
}
2279
2283
2280
2284
static void nvme_tcp_error_recovery_work (struct work_struct * work )
@@ -2301,7 +2305,7 @@ static void nvme_tcp_error_recovery_work(struct work_struct *work)
2301
2305
return ;
2302
2306
}
2303
2307
2304
- nvme_tcp_reconnect_or_remove (ctrl );
2308
+ nvme_tcp_reconnect_or_remove (ctrl , 0 );
2305
2309
}
2306
2310
2307
2311
static void nvme_tcp_teardown_ctrl (struct nvme_ctrl * ctrl , bool shutdown )
@@ -2321,6 +2325,7 @@ static void nvme_reset_ctrl_work(struct work_struct *work)
2321
2325
{
2322
2326
struct nvme_ctrl * ctrl =
2323
2327
container_of (work , struct nvme_ctrl , reset_work );
2328
+ int ret ;
2324
2329
2325
2330
nvme_stop_ctrl (ctrl );
2326
2331
nvme_tcp_teardown_ctrl (ctrl , false);
@@ -2334,14 +2339,15 @@ static void nvme_reset_ctrl_work(struct work_struct *work)
2334
2339
return ;
2335
2340
}
2336
2341
2337
- if (nvme_tcp_setup_ctrl (ctrl , false))
2342
+ ret = nvme_tcp_setup_ctrl (ctrl , false);
2343
+ if (ret )
2338
2344
goto out_fail ;
2339
2345
2340
2346
return ;
2341
2347
2342
2348
out_fail :
2343
2349
++ ctrl -> nr_reconnects ;
2344
- nvme_tcp_reconnect_or_remove (ctrl );
2350
+ nvme_tcp_reconnect_or_remove (ctrl , ret );
2345
2351
}
2346
2352
2347
2353
static void nvme_tcp_stop_ctrl (struct nvme_ctrl * ctrl )
0 commit comments