/* first some paranoia code */
if (req == NULL) {
- conn_err(connection, "BAD! BarrierAck #%u received, but no epoch in tl!?\n",
+ drbd_err(connection, "BAD! BarrierAck #%u received, but no epoch in tl!?\n",
barrier_nr);
goto bail;
}
if (expect_epoch != barrier_nr) {
- conn_err(connection, "BAD! BarrierAck #%u received, expected #%u!\n",
+ drbd_err(connection, "BAD! BarrierAck #%u received, expected #%u!\n",
barrier_nr, expect_epoch);
goto bail;
}
if (expect_size != set_size) {
- conn_err(connection, "BAD! BarrierAck #%u received with n_writes=%u, expected n_writes=%u!\n",
+ drbd_err(connection, "BAD! BarrierAck #%u received with n_writes=%u, expected n_writes=%u!\n",
barrier_nr, set_size, expect_size);
goto bail;
}
*/
if (thi->t_state == RESTARTING) {
- conn_info(connection, "Restarting %s thread\n", thi->name);
+ drbd_info(connection, "Restarting %s thread\n", thi->name);
thi->t_state = RUNNING;
spin_unlock_irqrestore(&thi->t_lock, flags);
goto restart;
complete_all(&thi->stop);
spin_unlock_irqrestore(&thi->t_lock, flags);
- conn_info(connection, "Terminating %s\n", current->comm);
+ drbd_info(connection, "Terminating %s\n", current->comm);
/* Release mod reference taken when thread was started */
switch (thi->t_state) {
case NONE:
- conn_info(connection, "Starting %s thread (from %s [%d])\n",
+ drbd_info(connection, "Starting %s thread (from %s [%d])\n",
thi->name, current->comm, current->pid);
/* Get ref on module for thread - this is released when thread exits */
if (!try_module_get(THIS_MODULE)) {
- conn_err(connection, "Failed to get module reference in drbd_thread_start\n");
+ drbd_err(connection, "Failed to get module reference in drbd_thread_start\n");
spin_unlock_irqrestore(&thi->t_lock, flags);
return false;
}
"drbd_%c_%s", thi->name[0], thi->connection->resource->name);
if (IS_ERR(nt)) {
- conn_err(connection, "Couldn't start thread\n");
+ drbd_err(connection, "Couldn't start thread\n");
kref_put(&connection->kref, drbd_destroy_connection);
module_put(THIS_MODULE);
break;
case EXITING:
thi->t_state = RESTARTING;
- conn_info(connection, "Restarting %s thread (from %s [%d])\n",
+ drbd_info(connection, "Restarting %s thread (from %s [%d])\n",
thi->name, current->comm, current->pid);
/* fall through */
case RUNNING:
if (nc->tentative && connection->agreed_pro_version < 92) {
rcu_read_unlock();
mutex_unlock(&sock->mutex);
- conn_err(connection, "--dry-run is not supported by peer");
+ drbd_err(connection, "--dry-run is not supported by peer");
return -EOPNOTSUPP;
}
drop_it = !--connection->ko_count;
if (!drop_it) {
- conn_err(connection, "[%s/%d] sock_sendmsg time expired, ko = %u\n",
+ drbd_err(connection, "[%s/%d] sock_sendmsg time expired, ko = %u\n",
current->comm, current->pid, connection->ko_count);
request_ping(connection);
}
if (rv <= 0) {
if (rv != -EAGAIN) {
- conn_err(connection, "%s_sendmsg returned %d\n",
+ drbd_err(connection, "%s_sendmsg returned %d\n",
sock == connection->meta.socket ? "msock" : "sock",
rv);
conn_request_state(connection, NS(conn, C_BROKEN_PIPE), CS_HARD);
err = bitmap_parse(res_opts->cpu_mask, 32,
cpumask_bits(new_cpu_mask), nr_cpu_ids);
if (err) {
- conn_warn(connection, "bitmap_parse() failed with %d\n", err);
+ drbd_warn(resource, "bitmap_parse() failed with %d\n", err);
/* retcode = ERR_CPU_MASK_PARSE; */
goto fail;
}
struct drbd_resource *resource = connection->resource;
if (atomic_read(&connection->current_epoch->epoch_size) != 0)
- conn_err(connection, "epoch_size:%d\n", atomic_read(&connection->current_epoch->epoch_size));
+ drbd_err(connection, "epoch_size:%d\n", atomic_read(&connection->current_epoch->epoch_size));
kfree(connection->current_epoch);
idr_destroy(&connection->peer_devices);
if (rv < 0) {
if (rv == -ECONNRESET)
- conn_info(connection, "sock was reset by peer\n");
+ drbd_info(connection, "sock was reset by peer\n");
else if (rv != -ERESTARTSYS)
- conn_err(connection, "sock_recvmsg returned %d\n", rv);
+ drbd_err(connection, "sock_recvmsg returned %d\n", rv);
} else if (rv == 0) {
if (test_bit(DISCONNECT_SENT, &connection->flags)) {
long t;
if (t)
goto out;
}
- conn_info(connection, "sock was shut down by peer\n");
+ drbd_info(connection, "sock was shut down by peer\n");
}
if (rv != size)
err = drbd_recv_all(connection, buf, size);
if (err && !signal_pending(current))
- conn_warn(connection, "short read (expected size %d)\n", (int)size);
+ drbd_warn(connection, "short read (expected size %d)\n", (int)size);
return err;
}
disconnect_on_error = 0;
break;
default:
- conn_err(connection, "%s failed, err = %d\n", what, err);
+ drbd_err(connection, "%s failed, err = %d\n", what, err);
}
if (disconnect_on_error)
conn_request_state(connection, NS(conn, C_DISCONNECTING), CS_HARD);
sock_release(s_listen);
if (err < 0) {
if (err != -EAGAIN && err != -EINTR && err != -ERESTARTSYS) {
- conn_err(connection, "%s failed, err = %d\n", what, err);
+ drbd_err(connection, "%s failed, err = %d\n", what, err);
conn_request_state(connection, NS(conn, C_DISCONNECTING), CS_HARD);
}
}
err = kernel_accept(ad->s_listen, &s_estab, 0);
if (err < 0) {
if (err != -EAGAIN && err != -EINTR && err != -ERESTARTSYS) {
- conn_err(connection, "accept failed, err = %d\n", err);
+ drbd_err(connection, "accept failed, err = %d\n", err);
conn_request_state(connection, NS(conn, C_DISCONNECTING), CS_HARD);
}
}
msock.socket = s;
send_first_packet(connection, &msock, P_INITIAL_META);
} else {
- conn_err(connection, "Logic error in conn_connect()\n");
+ drbd_err(connection, "Logic error in conn_connect()\n");
goto out_release_sockets;
}
}
switch (fp) {
case P_INITIAL_DATA:
if (sock.socket) {
- conn_warn(connection, "initial packet S crossed\n");
+ drbd_warn(connection, "initial packet S crossed\n");
sock_release(sock.socket);
sock.socket = s;
goto randomize;
case P_INITIAL_META:
set_bit(RESOLVE_CONFLICTS, &connection->flags);
if (msock.socket) {
- conn_warn(connection, "initial packet M crossed\n");
+ drbd_warn(connection, "initial packet M crossed\n");
sock_release(msock.socket);
msock.socket = s;
goto randomize;
msock.socket = s;
break;
default:
- conn_warn(connection, "Error receiving initial packet\n");
+ drbd_warn(connection, "Error receiving initial packet\n");
sock_release(s);
randomize:
if (prandom_u32() & 1)
/* drbd_request_state(device, NS(conn, WFAuth)); */
switch (drbd_do_auth(connection)) {
case -1:
- conn_err(connection, "Authentication of peer failed\n");
+ drbd_err(connection, "Authentication of peer failed\n");
return -1;
case 0:
- conn_err(connection, "Authentication of peer failed, trying again.\n");
+ drbd_err(connection, "Authentication of peer failed, trying again.\n");
return 0;
}
}
*(__be32 *)header == cpu_to_be32(DRBD_MAGIC_100)) {
struct p_header100 *h = header;
if (h->pad != 0) {
- conn_err(connection, "Header padding is not zero\n");
+ drbd_err(connection, "Header padding is not zero\n");
return -EINVAL;
}
pi->vnr = be16_to_cpu(h->volume);
pi->size = be16_to_cpu(h->length);
pi->vnr = 0;
} else {
- conn_err(connection, "Wrong magic value 0x%08x in protocol version %d\n",
+ drbd_err(connection, "Wrong magic value 0x%08x in protocol version %d\n",
be32_to_cpu(*(__be32 *)header),
connection->agreed_pro_version);
return -EINVAL;
rcu_read_unlock();
connection->write_ordering = wo;
if (pwo != connection->write_ordering || wo == WO_bdev_flush)
- conn_info(connection, "Method to ensure write ordering: %s\n", write_ordering_str[connection->write_ordering]);
+ drbd_info(connection, "Method to ensure write ordering: %s\n", write_ordering_str[connection->write_ordering]);
}
/**
if (epoch)
break;
else
- conn_warn(connection, "Allocation of an epoch failed, slowing down\n");
+ drbd_warn(connection, "Allocation of an epoch failed, slowing down\n");
/* Fall through */
case WO_bdev_flush:
return 0;
default:
- conn_err(connection, "Strangeness in connection->write_ordering %d\n", connection->write_ordering);
+ drbd_err(connection, "Strangeness in connection->write_ordering %d\n", connection->write_ordering);
return -EIO;
}
nc = rcu_dereference(connection->net_conf);
if (p_proto != nc->wire_protocol) {
- conn_err(connection, "incompatible %s settings\n", "protocol");
+ drbd_err(connection, "incompatible %s settings\n", "protocol");
goto disconnect_rcu_unlock;
}
if (convert_after_sb(p_after_sb_0p) != nc->after_sb_0p) {
- conn_err(connection, "incompatible %s settings\n", "after-sb-0pri");
+ drbd_err(connection, "incompatible %s settings\n", "after-sb-0pri");
goto disconnect_rcu_unlock;
}
if (convert_after_sb(p_after_sb_1p) != nc->after_sb_1p) {
- conn_err(connection, "incompatible %s settings\n", "after-sb-1pri");
+ drbd_err(connection, "incompatible %s settings\n", "after-sb-1pri");
goto disconnect_rcu_unlock;
}
if (convert_after_sb(p_after_sb_2p) != nc->after_sb_2p) {
- conn_err(connection, "incompatible %s settings\n", "after-sb-2pri");
+ drbd_err(connection, "incompatible %s settings\n", "after-sb-2pri");
goto disconnect_rcu_unlock;
}
if (p_discard_my_data && nc->discard_my_data) {
- conn_err(connection, "incompatible %s settings\n", "discard-my-data");
+ drbd_err(connection, "incompatible %s settings\n", "discard-my-data");
goto disconnect_rcu_unlock;
}
if (p_two_primaries != nc->two_primaries) {
- conn_err(connection, "incompatible %s settings\n", "allow-two-primaries");
+ drbd_err(connection, "incompatible %s settings\n", "allow-two-primaries");
goto disconnect_rcu_unlock;
}
if (strcmp(integrity_alg, nc->integrity_alg)) {
- conn_err(connection, "incompatible %s settings\n", "data-integrity-alg");
+ drbd_err(connection, "incompatible %s settings\n", "data-integrity-alg");
goto disconnect_rcu_unlock;
}
peer_integrity_tfm = crypto_alloc_hash(integrity_alg, 0, CRYPTO_ALG_ASYNC);
if (!peer_integrity_tfm) {
- conn_err(connection, "peer data-integrity-alg %s not supported\n",
+ drbd_err(connection, "peer data-integrity-alg %s not supported\n",
integrity_alg);
goto disconnect;
}
int_dig_in = kmalloc(hash_size, GFP_KERNEL);
int_dig_vv = kmalloc(hash_size, GFP_KERNEL);
if (!(int_dig_in && int_dig_vv)) {
- conn_err(connection, "Allocation of buffers for data integrity checking failed\n");
+ drbd_err(connection, "Allocation of buffers for data integrity checking failed\n");
goto disconnect;
}
}
new_net_conf = kmalloc(sizeof(struct net_conf), GFP_KERNEL);
if (!new_net_conf) {
- conn_err(connection, "Allocation of new net_conf failed\n");
+ drbd_err(connection, "Allocation of new net_conf failed\n");
goto disconnect;
}
connection->int_dig_vv = int_dig_vv;
if (strcmp(old_net_conf->integrity_alg, integrity_alg))
- conn_info(connection, "peer data-integrity-alg: %s\n",
+ drbd_info(connection, "peer data-integrity-alg: %s\n",
integrity_alg[0] ? integrity_alg : "(none)");
synchronize_rcu();
*/
static int config_unknown_volume(struct drbd_connection *connection, struct packet_info *pi)
{
- conn_warn(connection, "%s packet received for volume %u, which is not configured locally\n",
+ drbd_warn(connection, "%s packet received for volume %u, which is not configured locally\n",
cmdname(pi->cmd), pi->vnr);
return ignore_remaining_packet(connection, pi);
}
static int receive_skip(struct drbd_connection *connection, struct packet_info *pi)
{
- conn_warn(connection, "skipping unknown optional packet type %d, l: %d!\n",
+ drbd_warn(connection, "skipping unknown optional packet type %d, l: %d!\n",
pi->cmd, pi->size);
return ignore_remaining_packet(connection, pi);
cmd = &drbd_cmd_handler[pi.cmd];
if (unlikely(pi.cmd >= ARRAY_SIZE(drbd_cmd_handler) || !cmd->fn)) {
- conn_err(connection, "Unexpected data packet %s (0x%04x)",
+ drbd_err(connection, "Unexpected data packet %s (0x%04x)",
cmdname(pi.cmd), pi.cmd);
goto err_out;
}
shs = cmd->pkt_size;
if (pi.size > shs && !cmd->expect_payload) {
- conn_err(connection, "No payload expected %s l:%d\n",
+ drbd_err(connection, "No payload expected %s l:%d\n",
cmdname(pi.cmd), pi.size);
goto err_out;
}
err = cmd->fn(connection, &pi);
if (err) {
- conn_err(connection, "error receiving %s, e: %d l: %d!\n",
+ drbd_err(connection, "error receiving %s, e: %d l: %d!\n",
cmdname(pi.cmd), err, pi.size);
goto err_out;
}
rcu_read_unlock();
if (!list_empty(&connection->current_epoch->list))
- conn_err(connection, "ASSERTION FAILED: connection->current_epoch->list not empty\n");
+ drbd_err(connection, "ASSERTION FAILED: connection->current_epoch->list not empty\n");
/* ok, no more ee's on the fly, it is safe to reset the epoch_size */
atomic_set(&connection->current_epoch->epoch_size, 0);
connection->send.seen_any_write_yet = false;
- conn_info(connection, "Connection closed\n");
+ drbd_info(connection, "Connection closed\n");
if (conn_highest_role(connection) == R_PRIMARY && conn_highest_pdsk(connection) >= D_UNKNOWN)
conn_try_outdate_peer_async(connection);
return 0;
if (pi.cmd != P_CONNECTION_FEATURES) {
- conn_err(connection, "expected ConnectionFeatures packet, received: %s (0x%04x)\n",
+ drbd_err(connection, "expected ConnectionFeatures packet, received: %s (0x%04x)\n",
cmdname(pi.cmd), pi.cmd);
return -1;
}
if (pi.size != expect) {
- conn_err(connection, "expected ConnectionFeatures length: %u, received: %u\n",
+ drbd_err(connection, "expected ConnectionFeatures length: %u, received: %u\n",
expect, pi.size);
return -1;
}
connection->agreed_pro_version = min_t(int, PRO_VERSION_MAX, p->protocol_max);
- conn_info(connection, "Handshake successful: "
+ drbd_info(connection, "Handshake successful: "
"Agreed network protocol version %d\n", connection->agreed_pro_version);
return 1;
incompat:
- conn_err(connection, "incompatible DRBD dialects: "
+ drbd_err(connection, "incompatible DRBD dialects: "
"I support %d-%d, peer supports %d-%d\n",
PRO_VERSION_MIN, PRO_VERSION_MAX,
p->protocol_min, p->protocol_max);
#if !defined(CONFIG_CRYPTO_HMAC) && !defined(CONFIG_CRYPTO_HMAC_MODULE)
static int drbd_do_auth(struct drbd_connection *connection)
{
- conn_err(connection, "This kernel was build without CONFIG_CRYPTO_HMAC.\n");
- conn_err(connection, "You need to disable 'cram-hmac-alg' in drbd.conf.\n");
+ drbd_err(connection, "This kernel was build without CONFIG_CRYPTO_HMAC.\n");
+ drbd_err(connection, "You need to disable 'cram-hmac-alg' in drbd.conf.\n");
return -1;
}
#else
rv = crypto_hash_setkey(connection->cram_hmac_tfm, (u8 *)secret, key_len);
if (rv) {
- conn_err(connection, "crypto_hash_setkey() failed with %d\n", rv);
+ drbd_err(connection, "crypto_hash_setkey() failed with %d\n", rv);
rv = -1;
goto fail;
}
}
if (pi.cmd != P_AUTH_CHALLENGE) {
- conn_err(connection, "expected AuthChallenge packet, received: %s (0x%04x)\n",
+ drbd_err(connection, "expected AuthChallenge packet, received: %s (0x%04x)\n",
cmdname(pi.cmd), pi.cmd);
rv = 0;
goto fail;
}
if (pi.size > CHALLENGE_LEN * 2) {
- conn_err(connection, "expected AuthChallenge payload too big.\n");
+ drbd_err(connection, "expected AuthChallenge payload too big.\n");
rv = -1;
goto fail;
}
peers_ch = kmalloc(pi.size, GFP_NOIO);
if (peers_ch == NULL) {
- conn_err(connection, "kmalloc of peers_ch failed\n");
+ drbd_err(connection, "kmalloc of peers_ch failed\n");
rv = -1;
goto fail;
}
resp_size = crypto_hash_digestsize(connection->cram_hmac_tfm);
response = kmalloc(resp_size, GFP_NOIO);
if (response == NULL) {
- conn_err(connection, "kmalloc of response failed\n");
+ drbd_err(connection, "kmalloc of response failed\n");
rv = -1;
goto fail;
}
rv = crypto_hash_digest(&desc, &sg, sg.length, response);
if (rv) {
- conn_err(connection, "crypto_hash_digest() failed with %d\n", rv);
+ drbd_err(connection, "crypto_hash_digest() failed with %d\n", rv);
rv = -1;
goto fail;
}
}
if (pi.cmd != P_AUTH_RESPONSE) {
- conn_err(connection, "expected AuthResponse packet, received: %s (0x%04x)\n",
+ drbd_err(connection, "expected AuthResponse packet, received: %s (0x%04x)\n",
cmdname(pi.cmd), pi.cmd);
rv = 0;
goto fail;
}
if (pi.size != resp_size) {
- conn_err(connection, "expected AuthResponse payload of wrong size\n");
+ drbd_err(connection, "expected AuthResponse payload of wrong size\n");
rv = 0;
goto fail;
}
right_response = kmalloc(resp_size, GFP_NOIO);
if (right_response == NULL) {
- conn_err(connection, "kmalloc of right_response failed\n");
+ drbd_err(connection, "kmalloc of right_response failed\n");
rv = -1;
goto fail;
}
rv = crypto_hash_digest(&desc, &sg, sg.length, right_response);
if (rv) {
- conn_err(connection, "crypto_hash_digest() failed with %d\n", rv);
+ drbd_err(connection, "crypto_hash_digest() failed with %d\n", rv);
rv = -1;
goto fail;
}
rv = !memcmp(response, right_response, resp_size);
if (rv)
- conn_info(connection, "Peer authenticated using %d bytes HMAC\n",
+ drbd_info(connection, "Peer authenticated using %d bytes HMAC\n",
resp_size);
else
rv = -1;
struct drbd_connection *connection = thi->connection;
int h;
- conn_info(connection, "receiver (re)started\n");
+ drbd_info(connection, "receiver (re)started\n");
do {
h = conn_connect(connection);
schedule_timeout_interruptible(HZ);
}
if (h == -1) {
- conn_warn(connection, "Discarding network configuration.\n");
+ drbd_warn(connection, "Discarding network configuration.\n");
conn_request_state(connection, NS(conn, C_DISCONNECTING), CS_HARD);
}
} while (h == 0);
conn_disconnect(connection);
- conn_info(connection, "receiver terminated\n");
+ drbd_info(connection, "receiver terminated\n");
return 0;
}
set_bit(CONN_WD_ST_CHG_OKAY, &connection->flags);
} else {
set_bit(CONN_WD_ST_CHG_FAIL, &connection->flags);
- conn_err(connection, "Requested state change failed by peer: %s (%d)\n",
+ drbd_err(connection, "Requested state change failed by peer: %s (%d)\n",
drbd_set_st_err_str(retcode), retcode);
}
wake_up(&connection->ping_wait);
rv = sched_setscheduler(current, SCHED_RR, ¶m);
if (rv < 0)
- conn_err(connection, "drbd_asender: ERROR set priority, ret=%d\n", rv);
+ drbd_err(connection, "drbd_asender: ERROR set priority, ret=%d\n", rv);
while (get_t_state(thi) == RUNNING) {
drbd_thread_current_set_cpu(thi);
if (test_and_clear_bit(SEND_PING, &connection->flags)) {
if (drbd_send_ping(connection)) {
- conn_err(connection, "drbd_send_ping has failed\n");
+ drbd_err(connection, "drbd_send_ping has failed\n");
goto reconnect;
}
connection->meta.socket->sk->sk_rcvtimeo = ping_timeo * HZ / 10;
if (tcp_cork)
drbd_tcp_cork(connection->meta.socket);
if (connection_finish_peer_reqs(connection)) {
- conn_err(connection, "connection_finish_peer_reqs() failed\n");
+ drbd_err(connection, "connection_finish_peer_reqs() failed\n");
goto reconnect;
}
/* but unconditionally uncork unless disabled */
if (t)
break;
}
- conn_err(connection, "meta connection shut down by peer.\n");
+ drbd_err(connection, "meta connection shut down by peer.\n");
goto reconnect;
} else if (rv == -EAGAIN) {
/* If the data socket received something meanwhile,
jiffies - connection->meta.socket->sk->sk_rcvtimeo))
continue;
if (ping_timeout_active) {
- conn_err(connection, "PingAck did not arrive in time.\n");
+ drbd_err(connection, "PingAck did not arrive in time.\n");
goto reconnect;
}
set_bit(SEND_PING, &connection->flags);
} else if (rv == -EINTR) {
continue;
} else {
- conn_err(connection, "sock_recvmsg returned %d\n", rv);
+ drbd_err(connection, "sock_recvmsg returned %d\n", rv);
goto reconnect;
}
goto reconnect;
cmd = &asender_tbl[pi.cmd];
if (pi.cmd >= ARRAY_SIZE(asender_tbl) || !cmd->fn) {
- conn_err(connection, "Unexpected meta packet %s (0x%04x)\n",
+ drbd_err(connection, "Unexpected meta packet %s (0x%04x)\n",
cmdname(pi.cmd), pi.cmd);
goto disconnect;
}
expect = header_size + cmd->pkt_size;
if (pi.size != expect - header_size) {
- conn_err(connection, "Wrong packet size on meta (c: %d, l: %d)\n",
+ drbd_err(connection, "Wrong packet size on meta (c: %d, l: %d)\n",
pi.cmd, pi.size);
goto reconnect;
}
err = cmd->fn(connection, &pi);
if (err) {
- conn_err(connection, "%pf failed\n", cmd->fn);
+ drbd_err(connection, "%pf failed\n", cmd->fn);
goto reconnect;
}
}
clear_bit(SIGNAL_ASENDER, &connection->flags);
- conn_info(connection, "asender terminated\n");
+ drbd_info(connection, "asender terminated\n");
return 0;
}