@@ -2161,7 +2161,8 @@ static void nvme_tcp_teardown_io_queues(struct nvme_ctrl *ctrl,
21612161 nvme_tcp_destroy_io_queues (ctrl , remove );
21622162}
21632163
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 )
21652166{
21662167 enum nvme_ctrl_state state = nvme_ctrl_state (ctrl );
21672168
@@ -2171,13 +2172,14 @@ static void nvme_tcp_reconnect_or_remove(struct nvme_ctrl *ctrl)
21712172 return ;
21722173 }
21732174
2174- if (nvmf_should_reconnect (ctrl )) {
2175+ if (nvmf_should_reconnect (ctrl , status )) {
21752176 dev_info (ctrl -> device , "Reconnecting in %d seconds...\n" ,
21762177 ctrl -> opts -> reconnect_delay );
21772178 queue_delayed_work (nvme_wq , & to_tcp_ctrl (ctrl )-> connect_work ,
21782179 ctrl -> opts -> reconnect_delay * HZ );
21792180 } else {
2180- dev_info (ctrl -> device , "Removing controller...\n" );
2181+ dev_info (ctrl -> device , "Removing controller (%d)...\n" ,
2182+ status );
21812183 nvme_delete_ctrl (ctrl );
21822184 }
21832185}
@@ -2258,23 +2260,25 @@ static void nvme_tcp_reconnect_ctrl_work(struct work_struct *work)
22582260 struct nvme_tcp_ctrl * tcp_ctrl = container_of (to_delayed_work (work ),
22592261 struct nvme_tcp_ctrl , connect_work );
22602262 struct nvme_ctrl * ctrl = & tcp_ctrl -> ctrl ;
2263+ int ret ;
22612264
22622265 ++ ctrl -> nr_reconnects ;
22632266
2264- if (nvme_tcp_setup_ctrl (ctrl , false))
2267+ ret = nvme_tcp_setup_ctrl (ctrl , false);
2268+ if (ret )
22652269 goto requeue ;
22662270
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 );
22692273
22702274 ctrl -> nr_reconnects = 0 ;
22712275
22722276 return ;
22732277
22742278requeue :
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 );
22782282}
22792283
22802284static 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)
23012305 return ;
23022306 }
23032307
2304- nvme_tcp_reconnect_or_remove (ctrl );
2308+ nvme_tcp_reconnect_or_remove (ctrl , 0 );
23052309}
23062310
23072311static 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)
23212325{
23222326 struct nvme_ctrl * ctrl =
23232327 container_of (work , struct nvme_ctrl , reset_work );
2328+ int ret ;
23242329
23252330 nvme_stop_ctrl (ctrl );
23262331 nvme_tcp_teardown_ctrl (ctrl , false);
@@ -2334,14 +2339,15 @@ static void nvme_reset_ctrl_work(struct work_struct *work)
23342339 return ;
23352340 }
23362341
2337- if (nvme_tcp_setup_ctrl (ctrl , false))
2342+ ret = nvme_tcp_setup_ctrl (ctrl , false);
2343+ if (ret )
23382344 goto out_fail ;
23392345
23402346 return ;
23412347
23422348out_fail :
23432349 ++ ctrl -> nr_reconnects ;
2344- nvme_tcp_reconnect_or_remove (ctrl );
2350+ nvme_tcp_reconnect_or_remove (ctrl , ret );
23452351}
23462352
23472353static void nvme_tcp_stop_ctrl (struct nvme_ctrl * ctrl )
0 commit comments