Lines Matching refs:connection

112 	drbd_queue_work(&peer_device->connection->sender_work, &peer_req->w);
166 wake_asender(peer_device->connection);
357 digest_size = crypto_hash_digestsize(peer_device->connection->csums_tfm);
362 drbd_csum_ee(peer_device->connection->csums_tfm, peer_req, digest);
451 &first_peer_device(device)->connection->sender_work,
589 struct drbd_connection *const connection = peer_device ? peer_device->connection : NULL;
624 mutex_lock(&connection->data.mutex);
625 if (connection->data.socket) {
626 struct sock *sk = connection->data.socket->sk;
636 mutex_unlock(&connection->data.mutex);
833 struct drbd_connection *connection = first_peer_device(device)->connection;
835 clear_bit(GOT_PING_ACK, &connection->flags);
836 request_ping(connection);
837 wait_event(connection->ping_wait,
838 test_bit(GOT_PING_ACK, &connection->flags) || device->state.conn < C_CONNECTED);
864 drbd_queue_work(&first_peer_device(device)->connection->sender_work,
1016 * @cancel: The connection will be closed anyways
1053 * @cancel: The connection will be closed anyways
1132 if (peer_device->connection->csums_tfm) {
1133 digest_size = crypto_hash_digestsize(peer_device->connection->csums_tfm);
1138 drbd_csum_ee(peer_device->connection->csums_tfm, peer_req, digest);
1183 digest_size = crypto_hash_digestsize(peer_device->connection->verify_tfm);
1186 err = 1; /* terminate the connection in case the allocation failed */
1191 drbd_csum_ee(peer_device->connection->verify_tfm, peer_req, digest);
1255 digest_size = crypto_hash_digestsize(peer_device->connection->verify_tfm);
1258 drbd_csum_ee(peer_device->connection->verify_tfm, peer_req, digest);
1304 static int drbd_send_barrier(struct drbd_connection *connection)
1309 sock = &connection->data;
1310 p = conn_prepare_command(connection, sock);
1313 p->barrier = connection->send.current_epoch_nr;
1315 connection->send.current_epoch_writes = 0;
1317 return conn_send_command(connection, sock, P_BARRIER, sizeof(*p), NULL, 0);
1328 sock = &first_peer_device(device)->connection->data;
1334 static void re_init_if_first_write(struct drbd_connection *connection, unsigned int epoch)
1336 if (!connection->send.seen_any_write_yet) {
1337 connection->send.seen_any_write_yet = true;
1338 connection->send.current_epoch_nr = epoch;
1339 connection->send.current_epoch_writes = 0;
1343 static void maybe_send_barrier(struct drbd_connection *connection, unsigned int epoch)
1345 /* re-init if first write on this connection */
1346 if (!connection->send.seen_any_write_yet)
1348 if (connection->send.current_epoch_nr != epoch) {
1349 if (connection->send.current_epoch_writes)
1350 drbd_send_barrier(connection);
1351 connection->send.current_epoch_nr = epoch;
1360 struct drbd_connection *const connection = peer_device->connection;
1369 /* this time, no connection->send.current_epoch_writes++;
1373 maybe_send_barrier(connection, req->epoch);
1384 * @cancel: The connection will be closed anyways
1391 struct drbd_connection *connection = peer_device->connection;
1400 re_init_if_first_write(connection, req->epoch);
1401 maybe_send_barrier(connection, req->epoch);
1402 connection->send.current_epoch_writes++;
1413 * @cancel: The connection will be closed anyways
1420 struct drbd_connection *connection = peer_device->connection;
1431 maybe_send_barrier(connection, req->epoch);
1631 static bool use_checksum_based_resync(struct drbd_connection *connection, struct drbd_device *device)
1635 csums_after_crash_only = rcu_dereference(connection->net_conf)->csums_after_crash_only;
1637 return connection->agreed_pro_version >= 89 && /* supported? */
1638 connection->csums_tfm && /* configured? */
1654 struct drbd_connection *connection = peer_device ? peer_device->connection : NULL;
1672 "dropping connection.\n", r);
1673 conn_request_state(connection, NS(conn, C_DISCONNECTING), CS_HARD);
1685 "dropping connection.\n", r);
1686 conn_request_state(connection,
1694 if (current == connection->worker.task) {
1712 /* Did some connection breakage or IO error race with us? */
1779 device->use_csums = use_checksum_based_resync(connection, device);
1791 if (side == C_SYNC_SOURCE && connection->agreed_pro_version < 96)
1794 if (connection->agreed_pro_version < 95 && device->rs_total == 0) {
1796 * detect connection loss) that can lead to a full sync
1802 * detect connection loss, then waiting for a ping
1810 nc = rcu_dereference(connection->net_conf);
1968 static void do_unqueued_work(struct drbd_connection *connection)
1974 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {
1997 static void wait_for_work(struct drbd_connection *connection, struct list_head *work_list)
2003 dequeue_work_batch(&connection->sender_work, work_list);
2014 nc = rcu_dereference(connection->net_conf);
2018 mutex_lock(&connection->data.mutex);
2019 if (connection->data.socket)
2020 drbd_tcp_uncork(connection->data.socket);
2021 mutex_unlock(&connection->data.mutex);
2026 prepare_to_wait(&connection->sender_work.q_wait, &wait, TASK_INTERRUPTIBLE);
2027 spin_lock_irq(&connection->resource->req_lock);
2028 spin_lock(&connection->sender_work.q_lock); /* FIXME get rid of this one? */
2029 if (!list_empty(&connection->sender_work.q))
2030 list_splice_tail_init(&connection->sender_work.q, work_list);
2031 spin_unlock(&connection->sender_work.q_lock); /* FIXME get rid of this one? */
2033 spin_unlock_irq(&connection->resource->req_lock);
2039 * epoch. Next incoming request epoch will be connection ->
2045 atomic_read(&connection->current_tle_nr) !=
2046 connection->send.current_epoch_nr;
2047 spin_unlock_irq(&connection->resource->req_lock);
2050 maybe_send_barrier(connection,
2051 connection->send.current_epoch_nr + 1);
2053 if (test_bit(DEVICE_WORK_PENDING, &connection->flags))
2057 if (get_t_state(&connection->worker) != RUNNING)
2065 finish_wait(&connection->sender_work.q_wait, &wait);
2069 nc = rcu_dereference(connection->net_conf);
2072 mutex_lock(&connection->data.mutex);
2073 if (connection->data.socket) {
2075 drbd_tcp_cork(connection->data.socket);
2077 drbd_tcp_uncork(connection->data.socket);
2079 mutex_unlock(&connection->data.mutex);
2084 struct drbd_connection *connection = thi->connection;
2094 update_worker_timing_details(connection, wait_for_work);
2095 wait_for_work(connection, &work_list);
2098 if (test_and_clear_bit(DEVICE_WORK_PENDING, &connection->flags)) {
2099 update_worker_timing_details(connection, do_unqueued_work);
2100 do_unqueued_work(connection);
2106 drbd_warn(connection, "Worker got an unexpected signal\n");
2118 update_worker_timing_details(connection, w->cb);
2119 if (w->cb(w, connection->cstate < C_WF_REPORT_PARAMS) == 0)
2121 if (connection->cstate >= C_WF_REPORT_PARAMS)
2122 conn_request_state(connection, NS(conn, C_NETWORK_FAILURE), CS_HARD);
2127 if (test_and_clear_bit(DEVICE_WORK_PENDING, &connection->flags)) {
2128 update_worker_timing_details(connection, do_unqueued_work);
2129 do_unqueued_work(connection);
2134 update_worker_timing_details(connection, w->cb);
2137 dequeue_work_batch(&connection->sender_work, &work_list);
2138 } while (!list_empty(&work_list) || test_bit(DEVICE_WORK_PENDING, &connection->flags));
2141 idr_for_each_entry(&connection->peer_devices, peer_device, vnr) {