b/include/linux/ceph/ceph_debug.h
@@ -70,4 +70,13 @@
pr_err_ratelimited("[%pU %llu]: " fmt, &client-
>fsid, \
client->monc.auth->global_id,
##__VA_ARGS__)
+#define libceph_notice(fmt,
...) \
+ pr_notice_ratelimited(fmt, ##__VA_ARGS__)
+#define libceph_info(fmt,
...) \
+ pr_info_ratelimited(fmt, ##__VA_ARGS__)
+#define libceph_warn(fmt,
...) \
+ pr_warn_ratelimited(fmt, ##__VA_ARGS__)
+#define libceph_err(fmt,
...) \
+ pr_err_ratelimited(fmt, ##__VA_ARGS__)
+
#endif
@@ -31,7 +31,7 @@ static int init_protocol(struct ceph_auth_client *ac,
int proto)
case CEPH_AUTH_CEPHX:
return ceph_x_init(ac);
default:
- pr_err("bad auth protocol %d\n", proto);
+ libceph_err("bad auth protocol %d\n", proto);
return -EINVAL;
}
}
@@ -41,11 +41,12 @@ void ceph_auth_set_global_id(struct
ceph_auth_client *ac, u64 global_id)
dout("%s global_id %llu\n", __func__, global_id);
if (!global_id)
- pr_err("got zero global_id\n");
+ libceph_err("got zero global_id\n");
- if (ac->global_id && global_id != ac->global_id)
- pr_err("global_id changed from %llu to %llu\n", ac-
>global_id,
- global_id);
+ if (ac->global_id && global_id != ac->global_id) {
+ libceph_err("global_id changed from %llu to %llu\n",
ac->global_id,
+ global_id);
+ }
ac->global_id = global_id;
}
@@ -180,8 +181,8 @@ static int build_request(struct ceph_auth_client
*ac, bool add_header,
ceph_encode_need(&p, end, sizeof(u32), e_range);
ret = ac->ops->build_request(ac, p + sizeof(u32), end);
if (ret < 0) {
- pr_err("auth protocol '%s' building request failed:
%d\n",
- ceph_auth_proto_name(ac->protocol), ret);
+ libceph_err("auth protocol '%s' building request
failed: %d\n",
+ ceph_auth_proto_name(ac->protocol), ret);
return ret;
}
dout(" built request %d bytes\n", ret);
@@ -246,8 +247,9 @@ int ceph_handle_auth_reply(struct ceph_auth_client
*ac,
if (ac->protocol != protocol) {
ret = init_protocol(ac, protocol);
if (ret) {
- pr_err("auth protocol '%s' init
failed: %d\n",
- ceph_auth_proto_name(protocol),
ret);
+ libceph_err("auth protocol '%s' init
failed: %d\n",
+
ceph_auth_proto_name(protocol),
+ ret);
goto out;
}
}
@@ -256,8 +258,8 @@ int ceph_handle_auth_reply(struct ceph_auth_client
*ac,
}
if (result) {
- pr_err("auth protocol '%s' mauth authentication
failed: %d\n",
- ceph_auth_proto_name(ac->protocol), result);
+ libceph_err("auth protocol '%s' mauth authentication
failed: %d\n",
+ ceph_auth_proto_name(ac->protocol),
result);
ret = result;
goto out;
}
@@ -276,7 +278,7 @@ int ceph_handle_auth_reply(struct ceph_auth_client
*ac,
return ret;
bad:
- pr_err("failed to decode auth msg\n");
+ libceph_err("failed to decode auth msg\n");
ret = -EINVAL;
goto out;
}
@@ -436,8 +438,8 @@ int ceph_auth_get_request(struct ceph_auth_client
*ac, void *buf, int buf_len)
if (ac->protocol == CEPH_AUTH_UNKNOWN) {
ret = init_protocol(ac, proto);
if (ret) {
- pr_err("auth protocol '%s' init failed: %d\n",
- ceph_auth_proto_name(proto), ret);
+ libceph_err("auth protocol '%s' init failed:
%d\n",
+ ceph_auth_proto_name(proto), ret);
goto out;
}
} else {
@@ -514,27 +516,27 @@ bool ceph_auth_handle_bad_method(struct
ceph_auth_client *ac,
if (result == -EOPNOTSUPP) {
if (!contains(allowed_protos, proto_cnt, ac-
>protocol)) {
- pr_err("auth protocol '%s' not allowed\n",
- ceph_auth_proto_name(ac->protocol));
+ libceph_err("auth protocol '%s' not
allowed\n",
+ ceph_auth_proto_name(ac-
>protocol));
goto not_allowed;
}
if (!contains(allowed_modes, mode_cnt, ac-
>preferred_mode) &&
(ac->fallback_mode == CEPH_CON_MODE_UNKNOWN ||
!contains(allowed_modes, mode_cnt, ac-
>fallback_mode))) {
- pr_err("preferred mode '%s' not allowed\n",
- ceph_con_mode_name(ac-
>preferred_mode));
+ libceph_err("preferred mode '%s' not
allowed\n",
+ ceph_con_mode_name(ac-
>preferred_mode));
if (ac->fallback_mode ==
CEPH_CON_MODE_UNKNOWN)
- pr_err("no fallback mode\n");
+ libceph_err("no fallback mode\n");
else
- pr_err("fallback mode '%s' not
allowed\n",
- ceph_con_mode_name(ac-
>fallback_mode));
+ libceph_err("fallback mode '%s' not
allowed\n",
+ ceph_con_mode_name(ac-
>fallback_mode));
goto not_allowed;
}
}
WARN_ON(result == -EOPNOTSUPP || result >= 0);
- pr_err("auth protocol '%s' msgr authentication failed: %d\n",
- ceph_auth_proto_name(ac->protocol), result);
+ libceph_err("auth protocol '%s' msgr authentication failed:
%d\n",
+ ceph_auth_proto_name(ac->protocol), result);
mutex_unlock(&ac->mutex);
return true;
@@ -620,21 +622,21 @@ bool ceph_auth_handle_bad_authorizer(struct
ceph_auth_client *ac,
if (result == -EOPNOTSUPP) {
if (!contains(allowed_protos, proto_cnt, ac-
>protocol)) {
- pr_err("auth protocol '%s' not allowed by
%s\n",
- ceph_auth_proto_name(ac->protocol),
- ceph_entity_type_name(peer_type));
+ libceph_err("auth protocol '%s' not allowed by
%s\n",
+ ceph_auth_proto_name(ac-
>protocol),
+ ceph_entity_type_name(peer_type));
goto not_allowed;
}
if (!contains(allowed_modes, mode_cnt, ac-
>preferred_mode) &&
(ac->fallback_mode == CEPH_CON_MODE_UNKNOWN ||
!contains(allowed_modes, mode_cnt, ac-
>fallback_mode))) {
- pr_err("preferred mode '%s' not allowed by
%s\n",
- ceph_con_mode_name(ac->preferred_mode),
- ceph_entity_type_name(peer_type));
+ libceph_err("preferred mode '%s' not allowed
by %s\n",
+ ceph_con_mode_name(ac-
>preferred_mode),
+ ceph_entity_type_name(peer_type));
if (ac->fallback_mode ==
CEPH_CON_MODE_UNKNOWN)
- pr_err("no fallback mode\n");
+ libceph_err("no fallback mode\n");
else
- pr_err("fallback mode '%s' not allowed
by %s\n",
+ libceph_err("fallback mode '%s' not
allowed by %s\n",
ceph_con_mode_name(ac-
>fallback_mode),
ceph_entity_type_name(peer_type));
goto not_allowed;
@@ -642,9 +644,9 @@ bool ceph_auth_handle_bad_authorizer(struct
ceph_auth_client *ac,
}
WARN_ON(result == -EOPNOTSUPP || result >= 0);
- pr_err("auth protocol '%s' authorization to %s failed: %d\n",
- ceph_auth_proto_name(ac->protocol),
- ceph_entity_type_name(peer_type), result);
+ libceph_err("auth protocol '%s' authorization to %s failed:
%d\n",
+ ceph_auth_proto_name(ac->protocol),
+ ceph_entity_type_name(peer_type), result);
if (ac->ops->invalidate_authorizer)
ac->ops->invalidate_authorizer(ac, peer_type);
@@ -87,7 +87,7 @@ static int __ceph_x_decrypt(struct ceph_crypto_key
*secret, void *p,
return ret;
if (le64_to_cpu(hdr->magic) != CEPHX_ENC_MAGIC) {
- pr_err("%s bad magic\n", __func__);
+ libceph_err("%s bad magic\n", __func__);
return -EINVAL;
}
@@ -402,7 +402,7 @@ static int ceph_x_build_authorizer(struct
ceph_auth_client *ac,
get_random_bytes(&au->nonce, sizeof(au->nonce));
ret = encrypt_authorizer(au, NULL);
if (ret) {
- pr_err("failed to encrypt authorizer: %d", ret);
+ libceph_err("failed to encrypt authorizer: %d", ret);
goto out_au;
}
@@ -580,7 +580,7 @@ static int decode_con_secret(void **p, void *end,
u8 *con_secret,
dout("%s len %d\n", __func__, len);
if (con_secret) {
if (len > CEPH_MAX_CON_SECRET_LEN) {
- pr_err("connection secret too big %d\n", len);
+ libceph_err("connection secret too big %d\n",
len);
goto bad_memzero;
}
memcpy(con_secret, *p, len);
@@ -593,7 +593,7 @@ static int decode_con_secret(void **p, void *end,
u8 *con_secret,
bad_memzero:
memzero_explicit(*p, len);
bad:
- pr_err("failed to decode connection secret\n");
+ libceph_err("failed to decode connection secret\n");
return -EINVAL;
}
@@ -825,13 +825,14 @@ static int ceph_x_add_authorizer_challenge(struct
ceph_auth_client *ac,
ret = decrypt_authorizer_challenge(&au->session_key,
challenge,
challenge_len,
&server_challenge);
if (ret) {
- pr_err("failed to decrypt authorize challenge: %d",
ret);
+ libceph_err("failed to decrypt authorize challenge:
%d", ret);
return ret;
}
ret = encrypt_authorizer(au, &server_challenge);
if (ret) {
- pr_err("failed to encrypt authorizer w/ challenge:
%d", ret);
+ libceph_err("failed to encrypt authorizer w/
challenge: %d",
+ ret);
return ret;
}
@@ -894,7 +895,7 @@ static int ceph_x_verify_authorizer_reply(struct
ceph_auth_client *ac,
return ret;
if (nonce_plus_one != au->nonce + 1) {
- pr_err("failed to authenticate server\n");
+ libceph_err("failed to authenticate server\n");
return -EPERM;
}
@@ -1097,13 +1098,13 @@ int ceph_x_init(struct ceph_auth_client *ac)
ret = -EINVAL;
if (!ac->key) {
- pr_err("no secret set (for auth_x protocol)\n");
+ libceph_err("no secret set (for auth_x protocol)\n");
goto out_nomem;
}
ret = ceph_crypto_key_clone(&xi->secret, ac->key);
if (ret < 0) {
- pr_err("cannot clone key: %d\n", ret);
+ libceph_err("cannot clone key: %d\n", ret);
goto out_nomem;
}
@@ -106,8 +106,8 @@ int ceph_check_fsid(struct ceph_client *client,
struct ceph_fsid *fsid)
{
if (client->have_fsid) {
if (ceph_fsid_compare(&client->fsid, fsid)) {
- pr_err("bad fsid, had %pU got %pU",
- &client->fsid, fsid);
+ libceph_err("bad fsid, had %pU got %pU",
+ &client->fsid, fsid);
return -1;
}
} else {
@@ -822,8 +822,9 @@ int __ceph_open_session(struct ceph_client *client,
unsigned long started)
return client->auth_err;
}
- pr_info("client%llu fsid %pU\n", ceph_client_gid(client),
- &client->fsid);
+ libceph_info("client%llu fsid %pU\n",
+ ceph_client_gid(client),
+ &client->fsid);
ceph_debugfs_client_init(client);
return 0;
@@ -881,8 +882,8 @@ static int __init init_ceph_lib(void)
if (ret < 0)
goto out_msgr;
- pr_info("loaded (mon/osd proto %d/%d)\n",
- CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL);
+ libceph_info("loaded (mon/osd proto %d/%d)\n",
+ CEPH_MONC_PROTOCOL, CEPH_OSDC_PROTOCOL);
return 0;
@@ -239,8 +239,8 @@ static int ceph_aes_crypt(const struct
ceph_crypto_key *key, bool encrypt,
ret = crypto_skcipher_decrypt(req);
skcipher_request_zero(req);
if (ret) {
- pr_err("%s %scrypt failed: %d\n", __func__,
- encrypt ? "en" : "de", ret);
+ libceph_err("%s %scrypt failed: %d\n", __func__,
+ encrypt ? "en" : "de", ret);
goto out_sgt;
}
/*
@@ -256,8 +256,8 @@ static int ceph_aes_crypt(const struct
ceph_crypto_key *key, bool encrypt,
in_len >= pad_byte) {
*pout_len = in_len - pad_byte;
} else {
- pr_err("%s got bad padding %d on in_len %d\n",
- __func__, pad_byte, in_len);
+ libceph_err("%s got bad padding %d on in_len
%d\n",
+ __func__, pad_byte, in_len);
ret = -EPERM;
goto out_sgt;
}
@@ -106,7 +106,7 @@ int ceph_decode_entity_addrvec(void **p, void *end,
bool msgr2,
ceph_decode_8_safe(p, end, marker, e_inval);
if (marker != 2) {
- pr_err("bad addrvec marker %d\n", marker);
+ libceph_err("bad addrvec marker %d\n", marker);
return -EINVAL;
}
@@ -122,8 +122,8 @@ int ceph_decode_entity_addrvec(void **p, void *end,
bool msgr2,
dout("%s i %d addr %s\n", __func__, i,
ceph_pr_addr(&tmp_addr));
if (tmp_addr.type == my_type) {
if (found) {
- pr_err("another match of type %d in
addrvec\n",
- le32_to_cpu(my_type));
+ libceph_err("another match of type %d
in addrvec\n",
+ le32_to_cpu(my_type));
return -EINVAL;
}
@@ -141,7 +141,7 @@ int ceph_decode_entity_addrvec(void **p, void *end,
bool msgr2,
if (addr_cnt == 1 && !memchr_inv(&tmp_addr, 0,
sizeof(tmp_addr)))
return 0; /* weird but effectively the same as
!addr_cnt */
- pr_err("no match of type %d in addrvec\n",
le32_to_cpu(my_type));
+ libceph_err("no match of type %d in addrvec\n",
le32_to_cpu(my_type));
return -ENOENT;
e_inval:
@@ -256,7 +256,7 @@ int __init ceph_msgr_init(void)
if (ceph_msgr_wq)
return 0;
- pr_err("msgr_init failed to create workqueue\n");
+ libceph_err("msgr_init failed to create workqueue\n");
_ceph_msgr_exit();
return -ENOMEM;
@@ -466,8 +466,8 @@ int ceph_tcp_connect(struct ceph_connection *con)
ceph_pr_addr(&con->peer_addr),
sock->sk->sk_state);
} else if (ret < 0) {
- pr_err("connect %s error %d\n",
- ceph_pr_addr(&con->peer_addr), ret);
+ libceph_err("connect %s error %d\n",
+ ceph_pr_addr(&con->peer_addr), ret);
sock_release(sock);
return ret;
}
@@ -1278,7 +1278,8 @@ static int ceph_dns_resolve_name(const char
*name, size_t namelen,
*ipend = end;
- pr_info("resolve '%.*s' (ret=%d): %s\n", (int)(end - name),
name,
+ libceph_info("resolve '%.*s' (ret=%d): %s\n",
+ (int)(end - name), name,
ret, ret ? "failed" : ceph_pr_addr(addr));
return ret;
@@ -1616,8 +1617,8 @@ static void con_fault(struct ceph_connection
*con)
dout("fault %p state %d to peer %s\n",
con, con->state, ceph_pr_addr(&con->peer_addr));
- pr_warn("%s%lld %s %s\n", ENTITY_NAME(con->peer_name),
- ceph_pr_addr(&con->peer_addr), con->error_msg);
+ libceph_warn("%s%lld %s %s\n", ENTITY_NAME(con->peer_name),
+ ceph_pr_addr(&con->peer_addr), con->error_msg);
con->error_msg = NULL;
WARN_ON(con->state == CEPH_CON_S_STANDBY ||
@@ -2006,8 +2007,8 @@ struct ceph_msg *ceph_msg_new2(int type, int
front_len, int max_data_items,
ceph_msg_put(m);
out:
if (!can_fail) {
- pr_err("msg_new can't create type %d front %d\n",
type,
- front_len);
+ libceph_err("msg_new can't create type %d front %d\n",
type,
+ front_len);
WARN_ON(1);
} else {
dout("msg_new can't create type %d front %d\n", type,
@@ -663,8 +663,9 @@ static int read_partial_connect(struct
ceph_connection *con)
if (con->v1.auth) {
size = le32_to_cpu(con->v1.in_reply.authorizer_len);
if (size > con->v1.auth->authorizer_reply_buf_len) {
- pr_err("authorizer reply too big: %d > %zu\n",
size,
- con->v1.auth-
>authorizer_reply_buf_len);
+ libceph_err("authorizer reply too big: %d >
%zu\n",
+ size,
+ con->v1.auth-
>authorizer_reply_buf_len);
ret = -EINVAL;
goto out;
}
@@ -690,8 +691,8 @@ static int read_partial_connect(struct
ceph_connection *con)
static int verify_hello(struct ceph_connection *con)
{
if (memcmp(con->v1.in_banner, CEPH_BANNER,
strlen(CEPH_BANNER))) {
- pr_err("connect to %s got bad banner\n",
- ceph_pr_addr(&con->peer_addr));
+ libceph_err("connect to %s got bad banner\n",
+ ceph_pr_addr(&con->peer_addr));
con->error_msg = "protocol error, bad banner";
return -1;
}
@@ -716,11 +717,11 @@ static int process_banner(struct ceph_connection
*con)
sizeof(con->peer_addr)) != 0 &&
!(ceph_addr_is_blank(&con->v1.actual_peer_addr) &&
con->v1.actual_peer_addr.nonce == con->peer_addr.nonce))
{
- pr_warn("wrong peer, want %s/%u, got %s/%u\n",
- ceph_pr_addr(&con->peer_addr),
- le32_to_cpu(con->peer_addr.nonce),
- ceph_pr_addr(&con->v1.actual_peer_addr),
- le32_to_cpu(con->v1.actual_peer_addr.nonce));
+ libceph_warn("wrong peer, want %s/%u, got %s/%u\n",
+ ceph_pr_addr(&con->peer_addr),
+ le32_to_cpu(con->peer_addr.nonce),
+ ceph_pr_addr(&con->v1.actual_peer_addr),
+ le32_to_cpu(con-
>v1.actual_peer_addr.nonce));
con->error_msg = "wrong peer at address";
return -1;
}
@@ -784,21 +785,21 @@ static int process_connect(struct ceph_connection
*con)
switch (con->v1.in_reply.tag) {
case CEPH_MSGR_TAG_FEATURES:
- pr_err("%s%lld %s feature set mismatch,"
- " my %llx < server's %llx, missing %llx\n",
- ENTITY_NAME(con->peer_name),
- ceph_pr_addr(&con->peer_addr),
- sup_feat, server_feat, server_feat &
~sup_feat);
+ libceph_err("%s%lld %s feature set mismatch,"
+ " my %llx < server's %llx, missing
%llx\n",
+ ENTITY_NAME(con->peer_name),
+ ceph_pr_addr(&con->peer_addr),
+ sup_feat, server_feat, server_feat &
~sup_feat);
con->error_msg = "missing required protocol features";
return -1;
case CEPH_MSGR_TAG_BADPROTOVER:
- pr_err("%s%lld %s protocol version mismatch,"
- " my %d != server's %d\n",
- ENTITY_NAME(con->peer_name),
- ceph_pr_addr(&con->peer_addr),
- le32_to_cpu(con-
>v1.out_connect.protocol_version),
- le32_to_cpu(con-
>v1.in_reply.protocol_version));
+ libceph_err("%s%lld %s protocol version mismatch,"
+ " my %d != server's %d\n",
+ ENTITY_NAME(con->peer_name),
+ ceph_pr_addr(&con->peer_addr),
+ le32_to_cpu(con-
>v1.out_connect.protocol_version),
+ le32_to_cpu(con-
>v1.in_reply.protocol_version));
con->error_msg = "protocol version mismatch";
return -1;
@@ -827,9 +828,9 @@ static int process_connect(struct ceph_connection
*con)
*/
dout("process_connect got RESET peer seq %u\n",
le32_to_cpu(con->v1.in_reply.connect_seq));
- pr_info("%s%lld %s session reset\n",
- ENTITY_NAME(con->peer_name),
- ceph_pr_addr(&con->peer_addr));
+ libceph_info("%s%lld %s session reset\n",
+ ENTITY_NAME(con->peer_name),
+ ceph_pr_addr(&con->peer_addr));
ceph_con_reset_session(con);
con_out_kvec_reset(con);
ret = prepare_write_connect(con);
@@ -882,11 +883,12 @@ static int process_connect(struct ceph_connection
*con)
case CEPH_MSGR_TAG_SEQ:
case CEPH_MSGR_TAG_READY:
if (req_feat & ~server_feat) {
- pr_err("%s%lld %s protocol feature mismatch,"
- " my required %llx > server's %llx,
need %llx\n",
- ENTITY_NAME(con->peer_name),
- ceph_pr_addr(&con->peer_addr),
- req_feat, server_feat, req_feat &
~server_feat);
+ libceph_err("%s%lld %s protocol feature
mismatch,"
+ " my required %llx > server's
%llx, need %llx\n",
+ ENTITY_NAME(con->peer_name),
+ ceph_pr_addr(&con->peer_addr),
+ req_feat, server_feat,
+ req_feat & ~server_feat);
con->error_msg = "missing required protocol
features";
return -1;
}
@@ -1000,7 +1002,7 @@ static int read_partial_sparse_msg_extent(struct
ceph_connection *con, u32 *crc)
if (do_bounce && unlikely(!con->bounce_page)) {
con->bounce_page = alloc_page(GFP_NOIO);
if (!con->bounce_page) {
- pr_err("failed to allocate bounce page\n");
+ libceph_err("failed to allocate bounce
page\n");
return -ENOMEM;
}
}
@@ -1112,7 +1114,7 @@ static int read_partial_msg_data_bounce(struct
ceph_connection *con)
if (unlikely(!con->bounce_page)) {
con->bounce_page = alloc_page(GFP_NOIO);
if (!con->bounce_page) {
- pr_err("failed to allocate bounce page\n");
+ libceph_err("failed to allocate bounce
page\n");
return -ENOMEM;
}
}
@@ -1167,8 +1169,8 @@ static int read_partial_message(struct
ceph_connection *con)
crc = crc32c(0, &con->v1.in_hdr, offsetof(struct
ceph_msg_header, crc));
if (cpu_to_le32(crc) != con->v1.in_hdr.crc) {
- pr_err("read_partial_message bad hdr crc %u !=
expected %u\n",
- crc, con->v1.in_hdr.crc);
+ libceph_err("read_partial_message bad hdr crc %u !=
expected %u\n",
+ crc, con->v1.in_hdr.crc);
return -EBADMSG;
}
@@ -1185,17 +1187,17 @@ static int read_partial_message(struct
ceph_connection *con)
/* verify seq# */
seq = le64_to_cpu(con->v1.in_hdr.seq);
if ((s64)seq - (s64)con->in_seq < 1) {
- pr_info("skipping %s%lld %s seq %lld expected %lld\n",
- ENTITY_NAME(con->peer_name),
- ceph_pr_addr(&con->peer_addr),
- seq, con->in_seq + 1);
+ libceph_info("skipping %s%lld %s seq %lld expected
%lld\n",
+ ENTITY_NAME(con->peer_name),
+ ceph_pr_addr(&con->peer_addr),
+ seq, con->in_seq + 1);
con->v1.in_base_pos = -front_len - middle_len -
data_len -
sizeof_footer(con);
con->v1.in_tag = CEPH_MSGR_TAG_READY;
return 1;
} else if ((s64)seq - (s64)con->in_seq > 1) {
- pr_err("read_partial_message bad seq %lld expected
%lld\n",
- seq, con->in_seq + 1);
+ libceph_err("read_partial_message bad seq %lld
expected %lld\n",
+ seq, con->in_seq + 1);
con->error_msg = "bad message sequence # for incoming
message";
return -EBADE;
}
@@ -1282,26 +1284,28 @@ static int read_partial_message(struct
ceph_connection *con)
/* crc ok? */
if (con->in_front_crc != le32_to_cpu(m->footer.front_crc)) {
- pr_err("read_partial_message %p front crc %u != exp.
%u\n",
- m, con->in_front_crc, m->footer.front_crc);
+ libceph_err("read_partial_message %p front crc %u !=
exp. %u\n",
+ m, con->in_front_crc, m-
>footer.front_crc);
return -EBADMSG;
}
if (con->in_middle_crc != le32_to_cpu(m->footer.middle_crc)) {
- pr_err("read_partial_message %p middle crc %u != exp
%u\n",
- m, con->in_middle_crc, m->footer.middle_crc);
+ libceph_err("read_partial_message %p middle crc %u !=
exp %u\n",
+ m, con->in_middle_crc, m-
>footer.middle_crc);
return -EBADMSG;
}
if (do_datacrc &&
(m->footer.flags & CEPH_MSG_FOOTER_NOCRC) == 0 &&
con->in_data_crc != le32_to_cpu(m->footer.data_crc)) {
- pr_err("read_partial_message %p data crc %u != exp.
%u\n", m,
- con->in_data_crc, le32_to_cpu(m-
>footer.data_crc));
+ libceph_err("read_partial_message %p data crc %u !=
exp. %u\n",
+ m, con->in_data_crc,
+ le32_to_cpu(m->footer.data_crc));
return -EBADMSG;
}
if (need_sign && con->ops->check_message_signature &&
con->ops->check_message_signature(m)) {
- pr_err("read_partial_message %p signature check
failed\n", m);
+ libceph_err("read_partial_message %p signature check
failed\n",
+ m);
return -EBADMSG;
}
@@ -1460,7 +1464,7 @@ int ceph_con_v1_try_read(struct ceph_connection
*con)
return ret;
bad_tag:
- pr_err("try_read bad tag %d\n", con->v1.in_tag);
+ libceph_err("try_read bad tag %d\n", con->v1.in_tag);
con->error_msg = "protocol error, garbage tag";
ret = -1;
goto out;
@@ -509,8 +509,8 @@ static int decode_preamble(void *p, struct
ceph_frame_desc *desc)
crc = crc32c(0, p, crcp - p);
expected_crc = get_unaligned_le32(crcp);
if (crc != expected_crc) {
- pr_err("bad preamble crc, calculated %u, expected
%u\n",
- crc, expected_crc);
+ libceph_err("bad preamble crc, calculated %u, expected
%u\n",
+ crc, expected_crc);
return -EBADMSG;
}
@@ -520,7 +520,7 @@ static int decode_preamble(void *p, struct
ceph_frame_desc *desc)
desc->fd_seg_cnt = ceph_decode_8(&p);
if (desc->fd_seg_cnt < 1 ||
desc->fd_seg_cnt > CEPH_FRAME_MAX_SEGMENT_COUNT) {
- pr_err("bad segment count %d\n", desc->fd_seg_cnt);
+ libceph_err("bad segment count %d\n", desc-
>fd_seg_cnt);
return -EINVAL;
}
for (i = 0; i < desc->fd_seg_cnt; i++) {
@@ -530,22 +530,26 @@ static int decode_preamble(void *p, struct
ceph_frame_desc *desc)
if (desc->fd_lens[0] < 0 ||
desc->fd_lens[0] > CEPH_MSG_MAX_CONTROL_LEN) {
- pr_err("bad control segment length %d\n", desc-
>fd_lens[0]);
+ libceph_err("bad control segment length %d\n",
+ desc->fd_lens[0]);
return -EINVAL;
}
if (desc->fd_lens[1] < 0 ||
desc->fd_lens[1] > CEPH_MSG_MAX_FRONT_LEN) {
- pr_err("bad front segment length %d\n", desc-
>fd_lens[1]);
+ libceph_err("bad front segment length %d\n",
+ desc->fd_lens[1]);
return -EINVAL;
}
if (desc->fd_lens[2] < 0 ||
desc->fd_lens[2] > CEPH_MSG_MAX_MIDDLE_LEN) {
- pr_err("bad middle segment length %d\n", desc-
>fd_lens[2]);
+ libceph_err("bad middle segment length %d\n",
+ desc->fd_lens[2]);
return -EINVAL;
}
if (desc->fd_lens[3] < 0 ||
desc->fd_lens[3] > CEPH_MSG_MAX_DATA_LEN) {
- pr_err("bad data segment length %d\n", desc-
>fd_lens[3]);
+ libceph_err("bad data segment length %d\n",
+ desc->fd_lens[3]);
return -EINVAL;
}
@@ -554,8 +558,8 @@ static int decode_preamble(void *p, struct
ceph_frame_desc *desc)
* segment), but we should never get it as client.
*/
if (!desc->fd_lens[desc->fd_seg_cnt - 1]) {
- pr_err("last segment empty, segment count %d\n",
- desc->fd_seg_cnt);
+ libceph_err("last segment empty, segment count %d\n",
+ desc->fd_seg_cnt);
return -EINVAL;
}
@@ -587,7 +591,7 @@ static int decode_epilogue(void *p, u32 *front_crc,
u32 *middle_crc,
if ((late_status & FRAME_LATE_STATUS_ABORTED_MASK) !=
FRAME_LATE_STATUS_COMPLETE) {
/* we should never get an aborted message as client */
- pr_err("bad late_status 0x%x\n", late_status);
+ libceph_err("bad late_status 0x%x\n", late_status);
return -EINVAL;
}
@@ -647,8 +651,8 @@ static int verify_control_crc(struct
ceph_connection *con)
crc = crc32c(-1, con->v2.in_kvecs[0].iov_base, ctrl_len);
expected_crc = get_unaligned_le32(con-
>v2.in_kvecs[1].iov_base);
if (crc != expected_crc) {
- pr_err("bad control crc, calculated %u, expected
%u\n",
- crc, expected_crc);
+ libceph_err("bad control crc, calculated %u, expected
%u\n",
+ crc, expected_crc);
return -EBADMSG;
}
@@ -682,18 +686,18 @@ static int verify_epilogue_crcs(struct
ceph_connection *con, u32 front_crc,
con->in_front_crc, con->in_middle_crc, con->in_data_crc);
if (con->in_front_crc != front_crc) {
- pr_err("bad front crc, calculated %u, expected %u\n",
- con->in_front_crc, front_crc);
+ libceph_err("bad front crc, calculated %u, expected
%u\n",
+ con->in_front_crc, front_crc);
return -EBADMSG;
}
if (con->in_middle_crc != middle_crc) {
- pr_err("bad middle crc, calculated %u, expected %u\n",
- con->in_middle_crc, middle_crc);
+ libceph_err("bad middle crc, calculated %u, expected
%u\n",
+ con->in_middle_crc, middle_crc);
return -EBADMSG;
}
if (con->in_data_crc != data_crc) {
- pr_err("bad data crc, calculated %u, expected %u\n",
- con->in_data_crc, data_crc);
+ libceph_err("bad data crc, calculated %u, expected
%u\n",
+ con->in_data_crc, data_crc);
return -EBADMSG;
}
@@ -713,7 +717,7 @@ static int setup_crypto(struct ceph_connection
*con,
if (con->v2.con_mode != CEPH_CON_MODE_CRC &&
con->v2.con_mode != CEPH_CON_MODE_SECURE) {
- pr_err("bad con_mode %d\n", con->v2.con_mode);
+ libceph_err("bad con_mode %d\n", con->v2.con_mode);
return -EINVAL;
}
@@ -729,14 +733,14 @@ static int setup_crypto(struct ceph_connection
*con,
if (IS_ERR(con->v2.hmac_tfm)) {
ret = PTR_ERR(con->v2.hmac_tfm);
con->v2.hmac_tfm = NULL;
- pr_err("failed to allocate hmac tfm context: %d\n",
ret);
+ libceph_err("failed to allocate hmac tfm context:
%d\n", ret);
return ret;
}
ret = crypto_shash_setkey(con->v2.hmac_tfm, session_key,
session_key_len);
if (ret) {
- pr_err("failed to set hmac key: %d\n", ret);
+ libceph_err("failed to set hmac key: %d\n", ret);
return ret;
}
@@ -746,7 +750,7 @@ static int setup_crypto(struct ceph_connection
*con,
}
if (con_secret_len < CEPH_GCM_KEY_LEN + 2 * CEPH_GCM_IV_LEN) {
- pr_err("con_secret too small %d\n", con_secret_len);
+ libceph_err("con_secret too small %d\n",
con_secret_len);
return -EINVAL;
}
@@ -756,7 +760,7 @@ static int setup_crypto(struct ceph_connection
*con,
if (IS_ERR(con->v2.gcm_tfm)) {
ret = PTR_ERR(con->v2.gcm_tfm);
con->v2.gcm_tfm = NULL;
- pr_err("failed to allocate gcm tfm context: %d\n",
ret);
+ libceph_err("failed to allocate gcm tfm context:
%d\n", ret);
return ret;
}
@@ -764,20 +768,20 @@ static int setup_crypto(struct ceph_connection
*con,
crypto_aead_alignmask(con->v2.gcm_tfm));
ret = crypto_aead_setkey(con->v2.gcm_tfm, con_secret,
CEPH_GCM_KEY_LEN);
if (ret) {
- pr_err("failed to set gcm key: %d\n", ret);
+ libceph_err("failed to set gcm key: %d\n", ret);
return ret;
}
WARN_ON(crypto_aead_ivsize(con->v2.gcm_tfm) !=
CEPH_GCM_IV_LEN);
ret = crypto_aead_setauthsize(con->v2.gcm_tfm,
CEPH_GCM_TAG_LEN);
if (ret) {
- pr_err("failed to set gcm tag size: %d\n", ret);
+ libceph_err("failed to set gcm tag size: %d\n", ret);
return ret;
}
con->v2.gcm_req = aead_request_alloc(con->v2.gcm_tfm,
GFP_NOIO);
if (!con->v2.gcm_req) {
- pr_err("failed to allocate gcm request\n");
+ libceph_err("failed to allocate gcm request\n");
return -ENOMEM;
}
@@ -1870,7 +1874,7 @@ static int prepare_read_data(struct
ceph_connection *con)
if (unlikely(!con->bounce_page)) {
con->bounce_page = alloc_page(GFP_NOIO);
if (!con->bounce_page) {
- pr_err("failed to allocate bounce
page\n");
+ libceph_err("failed to allocate bounce
page\n");
return -ENOMEM;
}
}
@@ -1998,8 +2002,8 @@ static int prepare_sparse_read_cont(struct
ceph_connection *con)
}
if (ret > cursor->total_resid) {
- pr_warn("%s: ret 0x%x total_resid 0x%zx resid
0x%zx\n",
- __func__, ret, cursor->total_resid, cursor-
>resid);
+ libceph_warn("%s: ret 0x%x total_resid 0x%zx resid
0x%zx\n",
+ __func__, ret, cursor->total_resid,
cursor->resid);
return -EIO;
}
get_bvec_at(cursor, &bv);
@@ -2009,7 +2013,7 @@ static int prepare_sparse_read_cont(struct
ceph_connection *con)
if (unlikely(!con->bounce_page)) {
con->bounce_page = alloc_page(GFP_NOIO);
if (!con->bounce_page) {
- pr_err("failed to allocate bounce
page\n");
+ libceph_err("failed to allocate bounce
page\n");
return -ENOMEM;
}
}
@@ -2190,14 +2194,14 @@ static int process_banner_payload(struct
ceph_connection *con)
__func__, con, server_feat, server_req_feat);
if (req_feat & ~server_feat) {
- pr_err("msgr2 feature set mismatch: my required >
server's supported 0x%llx, need 0x%llx\n",
- server_feat, req_feat & ~server_feat);
+ libceph_err("msgr2 feature set mismatch: my required >
server's supported 0x%llx, need 0x%llx\n",
+ server_feat, req_feat & ~server_feat);
con->error_msg = "missing required protocol features";
return -EINVAL;
}
if (server_req_feat & ~feat) {
- pr_err("msgr2 feature set mismatch: server's required
> my supported 0x%llx, missing 0x%llx\n",
- feat, server_req_feat & ~feat);
+ libceph_err("msgr2 feature set mismatch: server's
required > my supported 0x%llx, missing 0x%llx\n",
+ feat, server_req_feat & ~feat);
con->error_msg = "missing required protocol features";
return -EINVAL;
}
@@ -2205,7 +2209,7 @@ static int process_banner_payload(struct
ceph_connection *con)
/* no reset_out_kvecs() as our banner may still be pending */
ret = prepare_hello(con);
if (ret) {
- pr_err("prepare_hello failed: %d\n", ret);
+ libceph_err("prepare_hello failed: %d\n", ret);
return ret;
}
@@ -2214,7 +2218,7 @@ static int process_banner_payload(struct
ceph_connection *con)
return 0;
bad:
- pr_err("failed to decode banner payload\n");
+ libceph_err("failed to decode banner payload\n");
return -EINVAL;
}
@@ -2233,7 +2237,7 @@ static int process_hello(struct ceph_connection
*con, void *p, void *end)
ceph_decode_8_safe(&p, end, entity_type, bad);
ret = ceph_decode_entity_addr(&p, end, &addr_for_me);
if (ret) {
- pr_err("failed to decode addr_for_me: %d\n", ret);
+ libceph_err("failed to decode addr_for_me: %d\n",
ret);
return ret;
}
@@ -2241,8 +2245,8 @@ static int process_hello(struct ceph_connection
*con, void *p, void *end)
entity_type, ceph_pr_addr(&addr_for_me));
if (entity_type != con->peer_name.type) {
- pr_err("bad peer type, want %d, got %d\n",
- con->peer_name.type, entity_type);
+ libceph_err("bad peer type, want %d, got %d\n",
+ con->peer_name.type, entity_type);
con->error_msg = "wrong peer at address";
return -EINVAL;
}
@@ -2273,7 +2277,7 @@ static int process_hello(struct ceph_connection
*con, void *p, void *end)
ret = prepare_auth_request(con);
if (ret) {
if (ret != -EAGAIN)
- pr_err("prepare_auth_request failed: %d\n",
ret);
+ libceph_err("prepare_auth_request failed:
%d\n", ret);
return ret;
}
@@ -2281,7 +2285,7 @@ static int process_hello(struct ceph_connection
*con, void *p, void *end)
return 0;
bad:
- pr_err("failed to decode hello\n");
+ libceph_err("failed to decode hello\n");
return -EINVAL;
}
@@ -2306,7 +2310,7 @@ static int process_auth_bad_method(struct
ceph_connection *con,
ceph_decode_32_safe(&p, end, allowed_proto_cnt, bad);
if (allowed_proto_cnt > ARRAY_SIZE(allowed_protos)) {
- pr_err("allowed_protos too big %d\n",
allowed_proto_cnt);
+ libceph_err("allowed_protos too big %d\n",
allowed_proto_cnt);
return -EINVAL;
}
for (i = 0; i < allowed_proto_cnt; i++) {
@@ -2317,7 +2321,7 @@ static int process_auth_bad_method(struct
ceph_connection *con,
ceph_decode_32_safe(&p, end, allowed_mode_cnt, bad);
if (allowed_mode_cnt > ARRAY_SIZE(allowed_modes)) {
- pr_err("allowed_modes too big %d\n",
allowed_mode_cnt);
+ libceph_err("allowed_modes too big %d\n",
allowed_mode_cnt);
return -EINVAL;
}
for (i = 0; i < allowed_mode_cnt; i++) {
@@ -2343,7 +2347,7 @@ static int process_auth_bad_method(struct
ceph_connection *con,
return ret;
bad:
- pr_err("failed to decode auth_bad_method\n");
+ libceph_err("failed to decode auth_bad_method\n");
return -EINVAL;
}
@@ -2366,15 +2370,18 @@ static int process_auth_reply_more(struct
ceph_connection *con,
reset_out_kvecs(con);
ret = prepare_auth_request_more(con, p, payload_len);
if (ret) {
- if (ret != -EAGAIN)
- pr_err("prepare_auth_request_more failed:
%d\n", ret);
+ if (ret != -EAGAIN) {
+ libceph_err("prepare_auth_request_more failed:
%d\n",
+ ret);
+ }
+
return ret;
}
return 0;
bad:
- pr_err("failed to decode auth_reply_more\n");
+ libceph_err("failed to decode auth_reply_more\n");
return -EINVAL;
}
@@ -2433,7 +2440,7 @@ static int process_auth_done(struct
ceph_connection *con, void *p, void *end)
reset_out_kvecs(con);
ret = prepare_auth_signature(con);
if (ret) {
- pr_err("prepare_auth_signature failed: %d\n", ret);
+ libceph_err("prepare_auth_signature failed: %d\n",
ret);
goto out;
}
@@ -2445,7 +2452,7 @@ static int process_auth_done(struct
ceph_connection *con, void *p, void *end)
return ret;
bad:
- pr_err("failed to decode auth_done\n");
+ libceph_err("failed to decode auth_done\n");
return -EINVAL;
}
@@ -2477,7 +2484,7 @@ static int process_auth_signature(struct
ceph_connection *con,
if (!con->v2.server_cookie) {
ret = prepare_client_ident(con);
if (ret) {
- pr_err("prepare_client_ident failed: %d\n",
ret);
+ libceph_err("prepare_client_ident failed:
%d\n", ret);
return ret;
}
@@ -2485,7 +2492,8 @@ static int process_auth_signature(struct
ceph_connection *con,
} else {
ret = prepare_session_reconnect(con);
if (ret) {
- pr_err("prepare_session_reconnect failed:
%d\n", ret);
+ libceph_err("prepare_session_reconnect failed:
%d\n",
+ ret);
return ret;
}
@@ -2495,7 +2503,7 @@ static int process_auth_signature(struct
ceph_connection *con,
return 0;
bad:
- pr_err("failed to decode auth_signature\n");
+ libceph_err("failed to decode auth_signature\n");
return -EINVAL;
}
@@ -2518,7 +2526,7 @@ static int process_server_ident(struct
ceph_connection *con,
ret = ceph_decode_entity_addrvec(&p, end, true, &addr);
if (ret) {
- pr_err("failed to decode server addrs: %d\n", ret);
+ libceph_err("failed to decode server addrs: %d\n",
ret);
return ret;
}
@@ -2535,17 +2543,17 @@ static int process_server_ident(struct
ceph_connection *con,
/* is this who we intended to talk to? */
if (memcmp(&addr, &con->peer_addr, sizeof(con->peer_addr))) {
- pr_err("bad peer addr/nonce, want %s/%u, got %s/%u\n",
- ceph_pr_addr(&con->peer_addr),
- le32_to_cpu(con->peer_addr.nonce),
- ceph_pr_addr(&addr), le32_to_cpu(addr.nonce));
+ libceph_err("bad peer addr/nonce, want %s/%u, got
%s/%u\n",
+ ceph_pr_addr(&con->peer_addr),
+ le32_to_cpu(con->peer_addr.nonce),
+ ceph_pr_addr(&addr),
le32_to_cpu(addr.nonce));
con->error_msg = "wrong peer at address";
return -EINVAL;
}
if (client->required_features & ~features) {
- pr_err("RADOS feature set mismatch: my required >
server's supported 0x%llx, need 0x%llx\n",
- features, client->required_features &
~features);
+ libceph_err("RADOS feature set mismatch: my required >
server's supported 0x%llx, need 0x%llx\n",
+ features, client->required_features &
~features);
con->error_msg = "missing required protocol features";
return -EINVAL;
}
@@ -2579,7 +2587,7 @@ static int process_server_ident(struct
ceph_connection *con,
return 0;
bad:
- pr_err("failed to decode server_ident\n");
+ libceph_err("failed to decode server_ident\n");
return -EINVAL;
}
@@ -2595,13 +2603,13 @@ static int
process_ident_missing_features(struct ceph_connection *con,
}
ceph_decode_64_safe(&p, end, missing_features, bad);
- pr_err("RADOS feature set mismatch: server's required > my
supported 0x%llx, missing 0x%llx\n",
- client->supported_features, missing_features);
+ libceph_err("RADOS feature set mismatch: server's required >
my supported 0x%llx, missing 0x%llx\n",
+ client->supported_features, missing_features);
con->error_msg = "missing required protocol features";
return -EINVAL;
bad:
- pr_err("failed to decode ident_missing_features\n");
+ libceph_err("failed to decode ident_missing_features\n");
return -EINVAL;
}
@@ -2630,7 +2638,7 @@ static int process_session_reconnect_ok(struct
ceph_connection *con,
return 0;
bad:
- pr_err("failed to decode session_reconnect_ok\n");
+ libceph_err("failed to decode session_reconnect_ok\n");
return -EINVAL;
}
@@ -2656,14 +2664,15 @@ static int process_session_retry(struct
ceph_connection *con,
reset_out_kvecs(con);
ret = prepare_session_reconnect(con);
if (ret) {
- pr_err("prepare_session_reconnect (cseq) failed:
%d\n", ret);
+ libceph_err("prepare_session_reconnect (cseq) failed:
%d\n",
+ ret);
return ret;
}
return 0;
bad:
- pr_err("failed to decode session_retry\n");
+ libceph_err("failed to decode session_retry\n");
return -EINVAL;
}
@@ -2689,14 +2698,15 @@ static int process_session_retry_global(struct
ceph_connection *con,
reset_out_kvecs(con);
ret = prepare_session_reconnect(con);
if (ret) {
- pr_err("prepare_session_reconnect (gseq) failed:
%d\n", ret);
+ libceph_err("prepare_session_reconnect (gseq) failed:
%d\n",
+ ret);
return ret;
}
return 0;
bad:
- pr_err("failed to decode session_retry_global\n");
+ libceph_err("failed to decode session_retry_global\n");
return -EINVAL;
}
@@ -2717,8 +2727,9 @@ static int process_session_reset(struct
ceph_connection *con,
return -EINVAL;
}
- pr_info("%s%lld %s session reset\n", ENTITY_NAME(con-
>peer_name),
- ceph_pr_addr(&con->peer_addr));
+ libceph_info("%s%lld %s session reset\n",
+ ENTITY_NAME(con->peer_name),
+ ceph_pr_addr(&con->peer_addr));
ceph_con_reset_session(con);
mutex_unlock(&con->mutex);
@@ -2736,7 +2747,7 @@ static int process_session_reset(struct
ceph_connection *con,
reset_out_kvecs(con);
ret = prepare_client_ident(con);
if (ret) {
- pr_err("prepare_client_ident (rst) failed: %d\n",
ret);
+ libceph_err("prepare_client_ident (rst) failed: %d\n",
ret);
return ret;
}
@@ -2744,7 +2755,7 @@ static int process_session_reset(struct
ceph_connection *con,
return 0;
bad:
- pr_err("failed to decode session_reset\n");
+ libceph_err("failed to decode session_reset\n");
return -EINVAL;
}
@@ -2765,7 +2776,7 @@ static int process_keepalive2_ack(struct
ceph_connection *con,
return 0;
bad:
- pr_err("failed to decode keepalive2_ack\n");
+ libceph_err("failed to decode keepalive2_ack\n");
return -EINVAL;
}
@@ -2785,7 +2796,7 @@ static int process_ack(struct ceph_connection
*con, void *p, void *end)
return 0;
bad:
- pr_err("failed to decode ack\n");
+ libceph_err("failed to decode ack\n");
return -EINVAL;
}
@@ -2837,7 +2848,7 @@ static int process_control(struct ceph_connection
*con, void *p, void *end)
ret = process_ack(con, p, end);
break;
default:
- pr_err("bad tag %d\n", tag);
+ libceph_err("bad tag %d\n", tag);
con->error_msg = "protocol error, bad tag";
return -EINVAL;
}
@@ -2869,14 +2880,15 @@ static int process_message_header(struct
ceph_connection *con,
/* verify seq# */
seq = le64_to_cpu(hdr2->seq);
if ((s64)seq - (s64)con->in_seq < 1) {
- pr_info("%s%lld %s skipping old message: seq %llu,
expected %llu\n",
- ENTITY_NAME(con->peer_name),
- ceph_pr_addr(&con->peer_addr),
- seq, con->in_seq + 1);
+ libceph_info("%s%lld %s skipping old message: seq
%llu, expected %llu\n",
+ ENTITY_NAME(con->peer_name),
+ ceph_pr_addr(&con->peer_addr),
+ seq, con->in_seq + 1);
return 0;
}
if ((s64)seq - (s64)con->in_seq > 1) {
- pr_err("bad seq %llu, expected %llu\n", seq, con-
>in_seq + 1);
+ libceph_err("bad seq %llu, expected %llu\n",
+ seq, con->in_seq + 1);
con->error_msg = "bad message sequence # for incoming
message";
return -EBADE;
}
@@ -3336,20 +3348,20 @@ static int populate_out_iter(struct
ceph_connection *con)
if (ceph_con_flag_test_and_clear(con,
CEPH_CON_F_KEEPALIVE_PENDING)) {
ret = prepare_keepalive2(con);
if (ret) {
- pr_err("prepare_keepalive2 failed: %d\n",
ret);
+ libceph_err("prepare_keepalive2 failed: %d\n",
ret);
return ret;
}
} else if (!list_empty(&con->out_queue)) {
ceph_con_get_out_msg(con);
ret = prepare_message(con);
if (ret) {
- pr_err("prepare_message failed: %d\n", ret);
+ libceph_err("prepare_message failed: %d\n",
ret);
return ret;
}
} else if (con->in_seq > con->in_seq_acked) {
ret = prepare_ack(con);
if (ret) {
- pr_err("prepare_ack failed: %d\n", ret);
+ libceph_err("prepare_ack failed: %d\n", ret);
return ret;
}
} else {
@@ -3392,7 +3404,8 @@ int ceph_con_v2_try_write(struct ceph_connection
*con)
ret = prepare_read_banner_prefix(con);
if (ret) {
- pr_err("prepare_read_banner_prefix failed:
%d\n", ret);
+ libceph_err("prepare_read_banner_prefix
failed: %d\n",
+ ret);
con->error_msg = "connect error";
return ret;
}
@@ -3400,14 +3413,14 @@ int ceph_con_v2_try_write(struct
ceph_connection *con)
reset_out_kvecs(con);
ret = prepare_banner(con);
if (ret) {
- pr_err("prepare_banner failed: %d\n", ret);
+ libceph_err("prepare_banner failed: %d\n",
ret);
con->error_msg = "connect error";
return ret;
}
ret = ceph_tcp_connect(con);
if (ret) {
- pr_err("ceph_tcp_connect failed: %d\n", ret);
+ libceph_err("ceph_tcp_connect failed: %d\n",
ret);
con->error_msg = "connect error";
return ret;
}
@@ -278,9 +278,11 @@ static void __open_session(struct ceph_mon_client
*monc)
static void reopen_session(struct ceph_mon_client *monc)
{
- if (!monc->hunting)
- pr_info("mon%d %s session lost, hunting for new
mon\n",
- monc->cur_mon, ceph_pr_addr(&monc-
>con.peer_addr));
+ if (!monc->hunting) {
+ libceph_info("mon%d %s session lost, hunting for new
mon\n",
+ monc->cur_mon,
+ ceph_pr_addr(&monc->con.peer_addr));
+ }
__close_session(monc);
__open_session(monc);
@@ -407,7 +409,7 @@ static void handle_subscribe_ack(struct
ceph_mon_client *monc,
mutex_unlock(&monc->mutex);
return;
bad:
- pr_err("got corrupt subscribe-ack msg\n");
+ libceph_err("got corrupt subscribe-ack msg\n");
ceph_msg_dump(msg);
}
@@ -551,8 +553,8 @@ static void ceph_monc_handle_map(struct
ceph_mon_client *monc,
monmap = ceph_monmap_decode(&p, end, ceph_msgr2(client));
if (IS_ERR(monmap)) {
- pr_err("problem decoding monmap, %d\n",
- (int)PTR_ERR(monmap));
+ libceph_err("problem decoding monmap, %d\n",
+ (int)PTR_ERR(monmap));
ceph_msg_dump(msg);
goto out;
}
@@ -763,7 +765,7 @@ static void handle_statfs_reply(struct
ceph_mon_client *monc,
return;
bad:
- pr_err("corrupt statfs reply, tid %llu\n", tid);
+ libceph_err("corrupt statfs reply, tid %llu\n", tid);
ceph_msg_dump(msg);
}
@@ -845,7 +847,7 @@ static void handle_get_version_reply(struct
ceph_mon_client *monc,
return;
bad:
- pr_err("corrupt mon_get_version reply, tid %llu\n", tid);
+ libceph_err("corrupt mon_get_version reply, tid %llu\n", tid);
ceph_msg_dump(msg);
}
@@ -965,7 +967,7 @@ static void handle_command_ack(struct
ceph_mon_client *monc,
return;
bad:
- pr_err("corrupt mon_command ack, tid %llu\n", tid);
+ libceph_err("corrupt mon_command ack, tid %llu\n", tid);
ceph_msg_dump(msg);
}
@@ -1305,8 +1307,9 @@ static void finish_auth(struct ceph_mon_client
*monc, int auth_err,
__send_subscribe(monc);
__resend_generic_request(monc);
- pr_info("mon%d %s session established\n", monc-
>cur_mon,
- ceph_pr_addr(&monc->con.peer_addr));
+ libceph_info("mon%d %s session established\n",
+ monc->cur_mon,
+ ceph_pr_addr(&monc->con.peer_addr));
}
}
@@ -1482,8 +1485,8 @@ static void mon_dispatch(struct ceph_connection
*con, struct ceph_msg *msg)
monc->client->extra_mon_dispatch(monc->client,
msg) == 0)
break;
- pr_err("received unknown message type %d %s\n", type,
- ceph_msg_type_name(type));
+ libceph_err("received unknown message type %d %s\n",
type,
+ ceph_msg_type_name(type));
}
ceph_msg_put(msg);
}
@@ -1533,13 +1536,13 @@ static struct ceph_msg *mon_alloc_msg(struct
ceph_connection *con,
}
if (!m) {
- pr_info("alloc_msg unknown type %d\n", type);
+ libceph_info("alloc_msg unknown type %d\n", type);
*skip = 1;
} else if (front_len > m->front_alloc_len) {
- pr_warn("mon_alloc_msg front %d > prealloc %d
(%u#%llu)\n",
- front_len, m->front_alloc_len,
- (unsigned int)con->peer_name.type,
- le64_to_cpu(con->peer_name.num));
+ libceph_warn("mon_alloc_msg front %d > prealloc %d
(%u#%llu)\n",
+ front_len, m->front_alloc_len,
+ (unsigned int)con->peer_name.type,
+ le64_to_cpu(con->peer_name.num));
ceph_msg_put(m);
m = ceph_msg_new(type, front_len, GFP_NOFS, false);
}
@@ -63,9 +63,10 @@ struct ceph_msg *ceph_msgpool_get(struct
ceph_msgpool *pool, int front_len,
if (front_len > pool->front_len ||
max_data_items > pool->max_data_items) {
- pr_warn_ratelimited("%s need %d/%d, pool %s has
%d/%d\n",
- __func__, front_len, max_data_items, pool->name,
- pool->front_len, pool->max_data_items);
+ libceph_warn("%s need %d/%d, pool %s has %d/%d\n",
+ __func__, front_len, max_data_items,
+ pool->name, pool->front_len,
+ pool->max_data_items);
WARN_ON_ONCE(1);
/* try to alloc a fresh message */
@@ -1053,8 +1053,8 @@ static u32 osd_req_encode_op(struct ceph_osd_op
*dst,
dst->assert_ver.ver = cpu_to_le64(src-
>assert_ver.ver);
break;
default:
- pr_err("unsupported osd opcode %s\n",
- ceph_osd_op_name(src->op));
+ libceph_err("unsupported osd opcode %s\n",
+ ceph_osd_op_name(src->op));
WARN_ON(1);
return 0;
@@ -1858,7 +1858,7 @@ static int decode_hoid(void **p, void *end,
struct ceph_hobject_id *hoid)
return ret;
if (struct_v < 4) {
- pr_err("got struct_v %d < 4 of hobject_t\n",
struct_v);
+ libceph_err("got struct_v %d < 4 of hobject_t\n",
struct_v);
goto e_inval;
}
@@ -2448,10 +2448,10 @@ static void __submit_request(struct
ceph_osd_request *req, bool wrlocked)
err = -ENOSPC;
} else {
if (ceph_osdmap_flag(osdc, CEPH_OSDMAP_FULL))
- pr_warn_ratelimited("cluster is full
(osdmap FULL)\n");
+ libceph_warn("cluster is full (osdmap
FULL)\n");
else
- pr_warn_ratelimited("pool %lld is full
or reached quota\n",
- req-
>r_t.base_oloc.pool);
+ libceph_warn("pool %lld is full or
reached quota\n",
+ req->r_t.base_oloc.pool);
req->r_t.paused = true;
maybe_request_map(osdc);
}
@@ -2721,8 +2721,8 @@ static void check_pool_dne(struct
ceph_osd_request *req)
if (req->r_map_dne_bound) {
if (map->epoch >= req->r_map_dne_bound) {
/* we had a new enough map */
- pr_info_ratelimited("tid %llu pool does not
exist\n",
- req->r_tid);
+ libceph_info("tid %llu pool does not exist\n",
+ req->r_tid);
complete_request(req, -ENOENT);
}
} else {
@@ -3048,7 +3048,7 @@ static void queue_watch_error(struct
ceph_osd_linger_request *lreq)
lwork = lwork_alloc(lreq, do_watch_error);
if (!lwork) {
- pr_err("failed to allocate error-lwork\n");
+ libceph_err("failed to allocate error-lwork\n");
return;
}
@@ -3354,8 +3354,8 @@ static void check_linger_pool_dne(struct
ceph_osd_linger_request *lreq)
if (lreq->map_dne_bound) {
if (map->epoch >= lreq->map_dne_bound) {
/* we had a new enough map */
- pr_info("linger_id %llu pool does not
exist\n",
- lreq->linger_id);
+ libceph_info("linger_id %llu pool does not
exist\n",
+ lreq->linger_id);
linger_reg_commit_complete(lreq, -ENOENT);
__linger_cancel(lreq);
}
@@ -3480,8 +3480,8 @@ static void handle_timeout(struct work_struct
*work)
}
if (opts->osd_request_timeout &&
time_before(req->r_start_stamp,
expiry_cutoff)) {
- pr_err_ratelimited("tid %llu on osd%d
timeout\n",
- req->r_tid, osd->o_osd);
+ libceph_err("tid %llu on osd%d
timeout\n",
+ req->r_tid, osd->o_osd);
abort_request(req, -ETIMEDOUT);
}
}
@@ -3511,8 +3511,9 @@ static void handle_timeout(struct work_struct
*work)
p = rb_next(p); /* abort_request() */
if (time_before(req->r_start_stamp,
expiry_cutoff)) {
- pr_err_ratelimited("tid %llu on osd%d
timeout\n",
- req->r_tid, osdc-
>homeless_osd.o_osd);
+ libceph_err("tid %llu on osd%d
timeout\n",
+ req->r_tid,
+ osdc->homeless_osd.o_osd);
abort_request(req, -ETIMEDOUT);
}
}
@@ -3570,13 +3571,13 @@ static int ceph_oloc_decode(void **p, void
*end,
struct_v = ceph_decode_8(p);
struct_cv = ceph_decode_8(p);
if (struct_v < 3) {
- pr_warn("got v %d < 3 cv %d of ceph_object_locator\n",
- struct_v, struct_cv);
+ libceph_warn("got v %d < 3 cv %d of
ceph_object_locator\n",
+ struct_v, struct_cv);
goto e_inval;
}
if (struct_cv > 6) {
- pr_warn("got v %d cv %d > 6 of ceph_object_locator\n",
- struct_v, struct_cv);
+ libceph_warn("got v %d cv %d > 6 of
ceph_object_locator\n",
+ struct_v, struct_cv);
goto e_inval;
}
len = ceph_decode_32(p);
@@ -3588,7 +3589,7 @@ static int ceph_oloc_decode(void **p, void *end,
len = ceph_decode_32(p);
if (len > 0) {
- pr_warn("ceph_object_locator::key is set\n");
+ libceph_warn("ceph_object_locator::key is set\n");
goto e_inval;
}
@@ -3608,7 +3609,7 @@ static int ceph_oloc_decode(void **p, void *end,
}
if (changed) {
/* redirect changes namespace */
- pr_warn("ceph_object_locator::nspace is
changed\n");
+ libceph_warn("ceph_object_locator::nspace is
changed\n");
goto e_inval;
}
}
@@ -3616,7 +3617,7 @@ static int ceph_oloc_decode(void **p, void *end,
if (struct_v >= 6) {
s64 hash = ceph_decode_64(p);
if (hash != -1) {
- pr_warn("ceph_object_locator::hash is set\n");
+ libceph_warn("ceph_object_locator::hash is
set\n");
goto e_inval;
}
}
@@ -3643,8 +3644,8 @@ static int ceph_redirect_decode(void **p, void
*end,
struct_v = ceph_decode_8(p);
struct_cv = ceph_decode_8(p);
if (struct_cv > 1) {
- pr_warn("got v %d cv %d > 1 of
ceph_request_redirect\n",
- struct_v, struct_cv);
+ libceph_warn("got v %d cv %d > 1 of
ceph_request_redirect\n",
+ struct_v, struct_cv);
goto e_inval;
}
len = ceph_decode_32(p);
@@ -3657,7 +3658,7 @@ static int ceph_redirect_decode(void **p, void
*end,
len = ceph_decode_32(p);
if (len > 0) {
- pr_warn("ceph_request_redirect::object_name is
set\n");
+ libceph_warn("ceph_request_redirect::object_name is
set\n");
goto e_inval;
}
@@ -3795,8 +3796,8 @@ static void handle_reply(struct ceph_osd *osd,
struct ceph_msg *msg)
ret = decode_MOSDOpReply(msg, &m);
m.redirect.oloc.pool_ns = NULL;
if (ret) {
- pr_err("failed to decode MOSDOpReply for tid %llu:
%d\n",
- req->r_tid, ret);
+ libceph_err("failed to decode MOSDOpReply for tid
%llu: %d\n",
+ req->r_tid, ret);
ceph_msg_dump(msg);
goto fail_request;
}
@@ -3856,8 +3857,8 @@ static void handle_reply(struct ceph_osd *osd,
struct ceph_msg *msg)
}
if (m.num_ops != req->r_num_ops) {
- pr_err("num_ops %d != %d for tid %llu\n", m.num_ops,
- req->r_num_ops, req->r_tid);
+ libceph_err("num_ops %d != %d for tid %llu\n",
m.num_ops,
+ req->r_num_ops, req->r_tid);
goto fail_request;
}
for (i = 0; i < req->r_num_ops; i++) {
@@ -3868,8 +3869,8 @@ static void handle_reply(struct ceph_osd *osd,
struct ceph_msg *msg)
data_len += m.outdata_len[i];
}
if (data_len != le32_to_cpu(msg->hdr.data_len)) {
- pr_err("sum of lens %u != %u for tid %llu\n",
data_len,
- le32_to_cpu(msg->hdr.data_len), req->r_tid);
+ libceph_err("sum of lens %u != %u for tid %llu\n",
data_len,
+ le32_to_cpu(msg->hdr.data_len), req-
>r_tid);
goto fail_request;
}
dout("%s req %p tid %llu result %d data_len %u\n", __func__,
@@ -4255,7 +4256,7 @@ void ceph_osdc_handle_map(struct ceph_osd_client
*osdc, struct ceph_msg *msg)
return;
bad:
- pr_err("osdc handle_map corrupt msg\n");
+ libceph_err("osdc handle_map corrupt msg\n");
ceph_msg_dump(msg);
up_write(&osdc->lock);
}
@@ -4424,7 +4425,7 @@ static void handle_backoff_block(struct ceph_osd
*osd, struct MOSDBackoff *m)
if (!spg) {
spg = alloc_spg_mapping();
if (!spg) {
- pr_err("%s failed to allocate spg\n",
__func__);
+ libceph_err("%s failed to allocate spg\n",
__func__);
return;
}
spg->spgid = m->spgid; /* struct */
@@ -4433,7 +4434,7 @@ static void handle_backoff_block(struct ceph_osd
*osd, struct MOSDBackoff *m)
backoff = alloc_backoff();
if (!backoff) {
- pr_err("%s failed to allocate backoff\n", __func__);
+ libceph_err("%s failed to allocate backoff\n",
__func__);
return;
}
backoff->spgid = m->spgid; /* struct */
@@ -4452,7 +4453,7 @@ static void handle_backoff_block(struct ceph_osd
*osd, struct MOSDBackoff *m)
*/
msg = create_backoff_message(backoff, m->map_epoch);
if (!msg) {
- pr_err("%s failed to allocate msg\n", __func__);
+ libceph_err("%s failed to allocate msg\n", __func__);
return;
}
ceph_con_send(&osd->o_con, msg);
@@ -4482,17 +4483,17 @@ static void handle_backoff_unblock(struct
ceph_osd *osd,
backoff = lookup_backoff_by_id(&osd->o_backoffs_by_id, m->id);
if (!backoff) {
- pr_err("%s osd%d spgid %llu.%xs%d id %llu backoff
dne\n",
- __func__, osd->o_osd, m->spgid.pgid.pool,
- m->spgid.pgid.seed, m->spgid.shard, m->id);
+ libceph_err("%s osd%d spgid %llu.%xs%d id %llu backoff
dne\n",
+ __func__, osd->o_osd, m->spgid.pgid.pool,
+ m->spgid.pgid.seed, m->spgid.shard, m-
>id);
return;
}
if (hoid_compare(backoff->begin, m->begin) &&
hoid_compare(backoff->end, m->end)) {
- pr_err("%s osd%d spgid %llu.%xs%d id %llu bad
range?\n",
- __func__, osd->o_osd, m->spgid.pgid.pool,
- m->spgid.pgid.seed, m->spgid.shard, m->id);
+ libceph_err("%s osd%d spgid %llu.%xs%d id %llu bad
range?\n",
+ __func__, osd->o_osd, m->spgid.pgid.pool,
+ m->spgid.pgid.seed, m->spgid.shard, m-
>id);
/* unblock it anyway... */
}
@@ -4545,7 +4546,7 @@ static void handle_backoff(struct ceph_osd *osd,
struct ceph_msg *msg)
mutex_lock(&osd->lock);
ret = decode_MOSDBackoff(msg, &m);
if (ret) {
- pr_err("failed to decode MOSDBackoff: %d\n", ret);
+ libceph_err("failed to decode MOSDBackoff: %d\n",
ret);
ceph_msg_dump(msg);
goto out_unlock;
}
@@ -4558,7 +4559,8 @@ static void handle_backoff(struct ceph_osd *osd,
struct ceph_msg *msg)
handle_backoff_unblock(osd, &m);
break;
default:
- pr_err("%s osd%d unknown op %d\n", __func__, osd-
>o_osd, m.op);
+ libceph_err("%s osd%d unknown op %d\n",
+ __func__, osd->o_osd, m.op);
}
free_hoid(m.begin);
@@ -4646,7 +4648,7 @@ static void handle_watch_notify(struct
ceph_osd_client *osdc,
/* CEPH_WATCH_EVENT_NOTIFY */
lwork = lwork_alloc(lreq, do_watch_notify);
if (!lwork) {
- pr_err("failed to allocate notify-lwork\n");
+ libceph_err("failed to allocate notify-
lwork\n");
goto out_unlock_lreq;
}
@@ -4665,7 +4667,7 @@ static void handle_watch_notify(struct
ceph_osd_client *osdc,
return;
bad:
- pr_err("osdc handle_watch_notify corrupt msg\n");
+ libceph_err("osdc handle_watch_notify corrupt msg\n");
}
/*
@@ -5393,8 +5395,8 @@ static void osd_dispatch(struct ceph_connection
*con, struct ceph_msg *msg)
break;
default:
- pr_err("received unknown message type %d %s\n", type,
- ceph_msg_type_name(type));
+ libceph_err("received unknown message type %d %s\n",
type,
+ ceph_msg_type_name(type));
}
ceph_msg_put(msg);
@@ -5456,9 +5458,9 @@ static struct ceph_msg *get_reply(struct
ceph_connection *con,
ceph_msg_revoke_incoming(req->r_reply);
if (front_len > req->r_reply->front_alloc_len) {
- pr_warn("%s osd%d tid %llu front %d > preallocated
%d\n",
- __func__, osd->o_osd, req->r_tid, front_len,
- req->r_reply->front_alloc_len);
+ libceph_warn("%s osd%d tid %llu front %d >
preallocated %d\n",
+ __func__, osd->o_osd, req->r_tid,
front_len,
+ req->r_reply->front_alloc_len);
m = ceph_msg_new(CEPH_MSG_OSD_OPREPLY, front_len,
GFP_NOFS,
false);
if (!m)
@@ -5469,9 +5471,9 @@ static struct ceph_msg *get_reply(struct
ceph_connection *con,
srlen = sparse_data_requested(req);
if (!srlen && data_len > req->r_reply->data_length) {
- pr_warn("%s osd%d tid %llu data %d > preallocated %zu,
skipping\n",
- __func__, osd->o_osd, req->r_tid, data_len,
- req->r_reply->data_length);
+ libceph_warn("%s osd%d tid %llu data %d > preallocated
%zu, skipping\n",
+ __func__, osd->o_osd, req->r_tid,
data_len,
+ req->r_reply->data_length);
m = NULL;
*skip = 1;
goto out_unlock_session;
@@ -5532,8 +5534,8 @@ static struct ceph_msg *osd_alloc_msg(struct
ceph_connection *con,
case CEPH_MSG_OSD_OPREPLY:
return get_reply(con, hdr, skip);
default:
- pr_warn("%s osd%d unknown msg type %d, skipping\n",
__func__,
- osd->o_osd, type);
+ libceph_warn("%s osd%d unknown msg type %d,
skipping\n", __func__,
+ osd->o_osd, type);
*skip = 1;
return NULL;
}
@@ -5851,8 +5853,8 @@ static int osd_sparse_read(struct ceph_connection
*con,
sizeof(*sr->sr_extent),
GFP_NOIO);
if (!sr->sr_extent) {
- pr_err("%s: failed to allocate
%u extents\n",
- __func__, count);
+ libceph_err("%s: failed to
allocate %u extents\n",
+ __func__, count);
return -ENOMEM;
}
sr->sr_ext_len = count;
@@ -5876,8 +5878,8 @@ static int osd_sparse_read(struct ceph_connection
*con,
for (i = 0; i < count; i++)
len += sr->sr_extent[i].len;
if (sr->sr_datalen != len) {
- pr_warn_ratelimited("data len %u != extent len
%llu\n",
- sr->sr_datalen, len);
+ libceph_warn("data len %u != extent len
%llu\n",
+ sr->sr_datalen, len);
return -EREMOTEIO;
}
sr->sr_state = CEPH_SPARSE_READ_DATA;
@@ -456,8 +456,8 @@ static struct crush_map *crush_decode(void *pbyval,
void *end)
ceph_decode_need(p, end, 4*sizeof(u32), bad);
magic = ceph_decode_32(p);
if (magic != CRUSH_MAGIC) {
- pr_err("crush_decode magic %x != current %x\n",
- (unsigned int)magic, (unsigned
int)CRUSH_MAGIC);
+ libceph_err("crush_decode magic %x != current %x\n",
+ (unsigned int)magic, (unsigned
int)CRUSH_MAGIC);