@@ -96,14 +96,16 @@ static struct rds_connection *rds_conn_lookup(struct net *net,
96
96
* and receiving over this connection again in the future. It is up to
97
97
* the transport to have serialized this call with its send and recv.
98
98
*/
99
- static void rds_conn_reset (struct rds_connection * conn )
99
+ static void rds_conn_path_reset (struct rds_conn_path * cp )
100
100
{
101
+ struct rds_connection * conn = cp -> cp_conn ;
102
+
101
103
rdsdebug ("connection %pI4 to %pI4 reset\n" ,
102
104
& conn -> c_laddr , & conn -> c_faddr );
103
105
104
106
rds_stats_inc (s_conn_reset );
105
- rds_send_reset ( conn );
106
- conn -> c_flags = 0 ;
107
+ rds_send_path_reset ( cp );
108
+ cp -> cp_flags = 0 ;
107
109
108
110
/* Do not clear next_rx_seq here, else we cannot distinguish
109
111
* retransmitted packets from new packets, and will hand all
@@ -294,46 +296,54 @@ struct rds_connection *rds_conn_create_outgoing(struct net *net,
294
296
}
295
297
EXPORT_SYMBOL_GPL (rds_conn_create_outgoing );
296
298
297
- void rds_conn_shutdown (struct rds_connection * conn )
299
+ void rds_conn_shutdown (struct rds_conn_path * cp )
298
300
{
301
+ struct rds_connection * conn = cp -> cp_conn ;
302
+
299
303
/* shut it down unless it's down already */
300
- if (!rds_conn_transition ( conn , RDS_CONN_DOWN , RDS_CONN_DOWN )) {
304
+ if (!rds_conn_path_transition ( cp , RDS_CONN_DOWN , RDS_CONN_DOWN )) {
301
305
/*
302
306
* Quiesce the connection mgmt handlers before we start tearing
303
307
* things down. We don't hold the mutex for the entire
304
308
* duration of the shutdown operation, else we may be
305
309
* deadlocking with the CM handler. Instead, the CM event
306
310
* handler is supposed to check for state DISCONNECTING
307
311
*/
308
- mutex_lock (& conn -> c_cm_lock );
309
- if (!rds_conn_transition (conn , RDS_CONN_UP , RDS_CONN_DISCONNECTING )
310
- && !rds_conn_transition (conn , RDS_CONN_ERROR , RDS_CONN_DISCONNECTING )) {
311
- rds_conn_error (conn , "shutdown called in state %d\n" ,
312
- atomic_read (& conn -> c_state ));
313
- mutex_unlock (& conn -> c_cm_lock );
312
+ mutex_lock (& cp -> cp_cm_lock );
313
+ if (!rds_conn_path_transition (cp , RDS_CONN_UP ,
314
+ RDS_CONN_DISCONNECTING ) &&
315
+ !rds_conn_path_transition (cp , RDS_CONN_ERROR ,
316
+ RDS_CONN_DISCONNECTING )) {
317
+ rds_conn_path_error (cp ,
318
+ "shutdown called in state %d\n" ,
319
+ atomic_read (& cp -> cp_state ));
320
+ mutex_unlock (& cp -> cp_cm_lock );
314
321
return ;
315
322
}
316
- mutex_unlock (& conn -> c_cm_lock );
323
+ mutex_unlock (& cp -> cp_cm_lock );
317
324
318
- wait_event (conn -> c_waitq ,
319
- !test_bit (RDS_IN_XMIT , & conn -> c_flags ));
320
- wait_event (conn -> c_waitq ,
321
- !test_bit (RDS_RECV_REFILL , & conn -> c_flags ));
325
+ wait_event (cp -> cp_waitq ,
326
+ !test_bit (RDS_IN_XMIT , & cp -> cp_flags ));
327
+ wait_event (cp -> cp_waitq ,
328
+ !test_bit (RDS_RECV_REFILL , & cp -> cp_flags ));
322
329
323
- conn -> c_trans -> conn_shutdown (conn );
324
- rds_conn_reset (conn );
330
+ if (!conn -> c_trans -> t_mp_capable )
331
+ conn -> c_trans -> conn_shutdown (conn );
332
+ else
333
+ conn -> c_trans -> conn_path_shutdown (cp );
334
+ rds_conn_path_reset (cp );
325
335
326
- if (!rds_conn_transition (conn , RDS_CONN_DISCONNECTING , RDS_CONN_DOWN )) {
336
+ if (!rds_conn_path_transition (cp , RDS_CONN_DISCONNECTING ,
337
+ RDS_CONN_DOWN )) {
327
338
/* This can happen - eg when we're in the middle of tearing
328
339
* down the connection, and someone unloads the rds module.
329
340
* Quite reproduceable with loopback connections.
330
341
* Mostly harmless.
331
342
*/
332
- rds_conn_error (conn ,
333
- "%s: failed to transition to state DOWN, "
334
- "current state is %d\n" ,
335
- __func__ ,
336
- atomic_read (& conn -> c_state ));
343
+ rds_conn_path_error (cp , "%s: failed to transition "
344
+ "to state DOWN, current state "
345
+ "is %d\n" , __func__ ,
346
+ atomic_read (& cp -> cp_state ));
337
347
return ;
338
348
}
339
349
}
@@ -342,13 +352,13 @@ void rds_conn_shutdown(struct rds_connection *conn)
342
352
* The passive side of an IB loopback connection is never added
343
353
* to the conn hash, so we never trigger a reconnect on this
344
354
* conn - the reconnect is always triggered by the active peer. */
345
- cancel_delayed_work_sync (& conn -> c_conn_w );
355
+ cancel_delayed_work_sync (& cp -> cp_conn_w );
346
356
rcu_read_lock ();
347
357
if (!hlist_unhashed (& conn -> c_hash_node )) {
348
358
rcu_read_unlock ();
349
359
if (conn -> c_trans -> t_type != RDS_TRANS_TCP ||
350
- conn -> c_path [ 0 ]. cp_outgoing == 1 )
351
- rds_queue_reconnect (& conn -> c_path [ 0 ] );
360
+ cp -> cp_outgoing == 1 )
361
+ rds_queue_reconnect (cp );
352
362
} else {
353
363
rcu_read_unlock ();
354
364
}
0 commit comments