Lines Matching defs:connection
46 struct drbd_connection *connection;
54 for_each_connection(connection, resource)
79 state_change->connections[n].connection = NULL;
88 struct drbd_connection *connection;
112 for_each_connection(connection, resource) {
113 kref_get(&connection->kref);
114 connection_state_change->connection = connection;
116 connection->cstate;
118 conn_highest_peer(connection);
131 for_each_connection(connection, resource) {
134 peer_device = conn_peer_device(connection, device->vnr);
184 struct drbd_connection *connection =
185 connection_state_change->connection;
187 connection_state_change->cstate[NEW] = connection->cstate;
189 conn_highest_peer(connection);
270 struct drbd_connection *connection =
271 state_change->connections[n].connection;
273 if (connection)
274 kref_put(&connection->kref, drbd_destroy_connection);
294 bool conn_all_vols_unconf(struct drbd_connection *connection)
301 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
335 enum drbd_role conn_highest_role(struct drbd_connection *connection)
342 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
351 enum drbd_role conn_highest_peer(struct drbd_connection *connection)
358 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
367 enum drbd_disk_state conn_highest_disk(struct drbd_connection *connection)
374 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
383 enum drbd_disk_state conn_lowest_disk(struct drbd_connection *connection)
390 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
399 enum drbd_disk_state conn_highest_pdsk(struct drbd_connection *connection)
406 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
415 enum drbd_conns conn_lowest_conn(struct drbd_connection *connection)
422 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
431 static bool no_peer_wf_report_params(struct drbd_connection *connection)
438 idr_for_each_entry(&connection->peer_devices, peer_device, vnr)
448 static void wake_up_all_devices(struct drbd_connection *connection)
454 idr_for_each_entry(&connection->peer_devices, peer_device, vnr)
542 rv = is_valid_soft_transition(os, ns, first_peer_device(device)->connection);
591 rv = is_valid_soft_transition(os, ns, first_peer_device(device)->connection);
625 D_ASSERT(device, current != first_peer_device(device)->connection->worker.task);
799 static void conn_pr_state_change(struct drbd_connection *connection, union drbd_state os, union drbd_state ns,
813 drbd_info(connection, "%s\n", pb);
838 nc = rcu_dereference(first_peer_device(device)->connection->net_conf);
843 else if (conn_highest_peer(first_peer_device(device)->connection) == R_PRIMARY)
884 first_peer_device(device)->connection->agreed_pro_version < 88)
912 is_valid_soft_transition(union drbd_state os, union drbd_state ns, struct drbd_connection *connection)
935 /* While establishing a connection only allow cstate to change.
937 if (test_bit(STATE_SENT, &connection->flags) &&
976 /* no change -> nothing to do, at least for the connection part */
980 /* disconnect of an unconfigured connection does not make sense */
988 /* When establishing a connection we need to go through WF_REPORT_PARAMS!
1049 * When we loose connection, we have to set the state of the peers disk (pdsk)
1069 /* Implications from connection to peer and peer_isp */
1081 /* An implication of the disk states onto the connection state */
1113 /* Implications of the connection state on the disk states */
1227 if (first_peer_device(device)->connection->agreed_pro_version < 90)
1265 struct drbd_connection *connection = peer_device ? peer_device->connection : NULL;
1292 rv = is_valid_soft_transition(os, ns, connection);
1294 rv = is_valid_soft_transition(os, ns, connection);
1311 conn_pr_state_change(connection, os, ns,
1343 start_new_tl_epoch(connection);
1348 /* Wake up role changes, that were delayed because of connection establishing */
1350 no_peer_wf_report_params(connection)) {
1351 clear_bit(STATE_SENT, &connection->flags);
1352 wake_up_all_devices(connection);
1357 wake_up(&connection->ping_wait);
1445 drbd_thread_stop_nowait(&connection->receiver);
1449 drbd_thread_stop_nowait(&connection->receiver);
1454 drbd_thread_restart_nowait(&connection->receiver);
1456 /* Resume AL writing if we get a connection */
1459 connection->connect_cnt++;
1478 drbd_queue_work(&connection->sender_work,
1526 D_ASSERT(device, current == first_peer_device(device)->connection->worker.task);
1561 struct drbd_connection *connection = connection_state_change->connection;
1567 return notify_connection_state(skb, seq, connection, &connection_info, type);
1706 struct drbd_connection *connection = peer_device ? peer_device->connection : NULL;
1736 if (os.conn < C_CONNECTED && conn_lowest_conn(connection) >= C_CONNECTED)
1740 conn_lowest_disk(connection) == D_UP_TO_DATE)
1744 _tl_restart(connection, what);
1745 _conn_request_state(connection,
1755 if (resource->susp_fen && conn_lowest_conn(connection) >= C_CONNECTED) {
1756 /* case2: The connection was established again: */
1761 idr_for_each_entry(&connection->peer_devices, peer_device, vnr)
1771 _tl_restart(connection, RESEND);
1772 _conn_request_state(connection,
1786 connection->agreed_pro_version >= 96 && get_ldev(device)) {
1804 /* No point in queuing send_bitmap if we don't have a connection
2033 struct drbd_connection *connection;
2041 struct drbd_connection *connection = acscw->connection;
2053 drbd_thread_start(&connection->receiver);
2059 idr_for_each_entry(&connection->peer_devices, peer_device, vnr)
2062 notify_connection_state(NULL, 0, connection, NULL, NOTIFY_DESTROY);
2065 mutex_lock(&connection->resource->conf_update);
2066 old_conf = connection->net_conf;
2067 connection->my_addr_len = 0;
2068 connection->peer_addr_len = 0;
2069 RCU_INIT_POINTER(connection->net_conf, NULL);
2070 conn_free_crypto(connection);
2071 mutex_unlock(&connection->resource->conf_update);
2081 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
2089 spin_lock_irq(&connection->resource->req_lock);
2090 _tl_restart(connection, CONNECTION_LOST_WHILE_PENDING);
2091 _conn_request_state(connection,
2095 spin_unlock_irq(&connection->resource->req_lock);
2098 conn_md_sync(connection);
2099 kref_put(&connection->kref, drbd_destroy_connection);
2104 static void conn_old_common_state(struct drbd_connection *connection, union drbd_state *pcs, enum chg_state_flags *pf)
2112 .conn = connection->cstate,
2118 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
2151 conn_is_valid_transition(struct drbd_connection *connection, union drbd_state mask, union drbd_state val,
2160 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
2177 rv = is_valid_soft_transition(os, ns, connection);
2179 rv = is_valid_soft_transition(os, ns, connection);
2194 conn_set_state(struct drbd_connection *connection, union drbd_state mask, union drbd_state val,
2213 if (connection->cstate != C_WF_REPORT_PARAMS && val.conn == C_WF_REPORT_PARAMS)
2214 connection->last_reconnect_jif = jiffies;
2216 connection->cstate = val.conn;
2220 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
2257 ns_min.susp = ns_max.susp = connection->resource->susp;
2258 ns_min.susp_nod = ns_max.susp_nod = connection->resource->susp_nod;
2259 ns_min.susp_fen = ns_max.susp_fen = connection->resource->susp_fen;
2266 _conn_rq_cond(struct drbd_connection *connection, union drbd_state mask, union drbd_state val)
2270 if (test_and_clear_bit(CONN_WD_ST_CHG_OKAY, &connection->flags))
2273 if (test_and_clear_bit(CONN_WD_ST_CHG_FAIL, &connection->flags))
2276 err = conn_is_valid_transition(connection, mask, val, 0);
2277 if (err == SS_SUCCESS && connection->cstate == C_WF_REPORT_PARAMS)
2284 _conn_request_state(struct drbd_connection *connection, union drbd_state mask, union drbd_state val,
2289 enum drbd_conns oc = connection->cstate;
2300 rv = conn_is_valid_transition(connection, mask, val, flags);
2310 spin_unlock_irq(&connection->resource->req_lock);
2311 mutex_lock(&connection->cstate_mutex);
2314 set_bit(CONN_WD_ST_CHG_REQ, &connection->flags);
2315 if (conn_send_state_req(connection, mask, val)) {
2317 clear_bit(CONN_WD_ST_CHG_REQ, &connection->flags);
2324 set_bit(DISCONNECT_SENT, &connection->flags);
2329 spin_lock_irq(&connection->resource->req_lock);
2330 wait_event_lock_irq(connection->ping_wait,
2331 (rv = _conn_rq_cond(connection, mask, val)),
2332 connection->resource->req_lock);
2333 clear_bit(CONN_WD_ST_CHG_REQ, &connection->flags);
2338 state_change = remember_old_state(connection->resource, GFP_ATOMIC);
2339 conn_old_common_state(connection, &os, &flags);
2341 conn_set_state(connection, mask, val, &ns_min, &ns_max, flags);
2342 conn_pr_state_change(connection, os, ns_max, flags);
2352 kref_get(&connection->kref);
2353 acscw->connection = connection;
2355 drbd_queue_work(&connection->sender_work, &acscw->w);
2357 drbd_err(connection, "Could not kmalloc an acscw\n");
2364 spin_unlock_irq(&connection->resource->req_lock);
2366 mutex_unlock(&connection->cstate_mutex);
2367 spin_lock_irq(&connection->resource->req_lock);
2370 drbd_err(connection, "State change failed: %s\n", drbd_set_st_err_str(rv));
2371 drbd_err(connection, " mask = 0x%x val = 0x%x\n", mask.i, val.i);
2372 drbd_err(connection, " old_conn:%s wanted_conn:%s\n", drbd_conn_str(oc), drbd_conn_str(val.conn));
2378 conn_request_state(struct drbd_connection *connection, union drbd_state mask, union drbd_state val,
2383 spin_lock_irq(&connection->resource->req_lock);
2384 rv = _conn_request_state(connection, mask, val, flags);
2385 spin_unlock_irq(&connection->resource->req_lock);