Lines Matching refs:monc
37 static int __validate_auth(struct ceph_mon_client *monc);
175 static void __send_prepared_auth_request(struct ceph_mon_client *monc, int len) in __send_prepared_auth_request() argument
177 monc->pending_auth = 1; in __send_prepared_auth_request()
178 monc->m_auth->front.iov_len = len; in __send_prepared_auth_request()
179 monc->m_auth->hdr.front_len = cpu_to_le32(len); in __send_prepared_auth_request()
180 ceph_msg_revoke(monc->m_auth); in __send_prepared_auth_request()
181 ceph_msg_get(monc->m_auth); /* keep our ref */ in __send_prepared_auth_request()
182 ceph_con_send(&monc->con, monc->m_auth); in __send_prepared_auth_request()
188 static void __close_session(struct ceph_mon_client *monc) in __close_session() argument
190 dout("__close_session closing mon%d\n", monc->cur_mon); in __close_session()
191 ceph_msg_revoke(monc->m_auth); in __close_session()
192 ceph_msg_revoke_incoming(monc->m_auth_reply); in __close_session()
193 ceph_msg_revoke(monc->m_subscribe); in __close_session()
194 ceph_msg_revoke_incoming(monc->m_subscribe_ack); in __close_session()
195 ceph_con_close(&monc->con); in __close_session()
197 monc->pending_auth = 0; in __close_session()
198 ceph_auth_reset(monc->auth); in __close_session()
205 static void pick_new_mon(struct ceph_mon_client *monc) in pick_new_mon() argument
207 int old_mon = monc->cur_mon; in pick_new_mon()
209 BUG_ON(monc->monmap->num_mon < 1); in pick_new_mon()
211 if (monc->monmap->num_mon == 1) { in pick_new_mon()
212 monc->cur_mon = 0; in pick_new_mon()
214 int max = monc->monmap->num_mon; in pick_new_mon()
218 if (monc->cur_mon >= 0) { in pick_new_mon()
219 if (monc->cur_mon < monc->monmap->num_mon) in pick_new_mon()
220 o = monc->cur_mon; in pick_new_mon()
229 monc->cur_mon = n; in pick_new_mon()
233 monc->cur_mon, monc->monmap->num_mon); in pick_new_mon()
239 static void __open_session(struct ceph_mon_client *monc) in __open_session() argument
243 pick_new_mon(monc); in __open_session()
245 monc->hunting = true; in __open_session()
246 if (monc->had_a_connection) { in __open_session()
247 monc->hunt_mult *= CEPH_MONC_HUNT_BACKOFF; in __open_session()
248 if (monc->hunt_mult > CEPH_MONC_HUNT_MAX_MULT) in __open_session()
249 monc->hunt_mult = CEPH_MONC_HUNT_MAX_MULT; in __open_session()
252 monc->sub_renew_after = jiffies; /* i.e., expired */ in __open_session()
253 monc->sub_renew_sent = 0; in __open_session()
255 dout("%s opening mon%d\n", __func__, monc->cur_mon); in __open_session()
256 ceph_con_open(&monc->con, CEPH_ENTITY_TYPE_MON, monc->cur_mon, in __open_session()
257 &monc->monmap->mon_inst[monc->cur_mon].addr); in __open_session()
265 ceph_con_keepalive(&monc->con); in __open_session()
266 if (ceph_msgr2(monc->client)) { in __open_session()
267 monc->pending_auth = 1; in __open_session()
272 ret = ceph_auth_build_hello(monc->auth, in __open_session()
273 monc->m_auth->front.iov_base, in __open_session()
274 monc->m_auth->front_alloc_len); in __open_session()
276 __send_prepared_auth_request(monc, ret); in __open_session()
279 static void reopen_session(struct ceph_mon_client *monc) in reopen_session() argument
281 if (!monc->hunting) in reopen_session()
283 monc->cur_mon, ceph_pr_addr(&monc->con.peer_addr)); in reopen_session()
285 __close_session(monc); in reopen_session()
286 __open_session(monc); in reopen_session()
289 void ceph_monc_reopen_session(struct ceph_mon_client *monc) in ceph_monc_reopen_session() argument
291 mutex_lock(&monc->mutex); in ceph_monc_reopen_session()
292 reopen_session(monc); in ceph_monc_reopen_session()
293 mutex_unlock(&monc->mutex); in ceph_monc_reopen_session()
296 static void un_backoff(struct ceph_mon_client *monc) in un_backoff() argument
298 monc->hunt_mult /= 2; /* reduce by 50% */ in un_backoff()
299 if (monc->hunt_mult < 1) in un_backoff()
300 monc->hunt_mult = 1; in un_backoff()
301 dout("%s hunt_mult now %d\n", __func__, monc->hunt_mult); in un_backoff()
307 static void __schedule_delayed(struct ceph_mon_client *monc) in __schedule_delayed() argument
311 if (monc->hunting) in __schedule_delayed()
312 delay = CEPH_MONC_HUNT_INTERVAL * monc->hunt_mult; in __schedule_delayed()
317 mod_delayed_work(system_wq, &monc->delayed_work, in __schedule_delayed()
332 static void __send_subscribe(struct ceph_mon_client *monc) in __send_subscribe() argument
334 struct ceph_msg *msg = monc->m_subscribe; in __send_subscribe()
340 dout("%s sent %lu\n", __func__, monc->sub_renew_sent); in __send_subscribe()
342 BUG_ON(monc->cur_mon < 0); in __send_subscribe()
344 if (!monc->sub_renew_sent) in __send_subscribe()
345 monc->sub_renew_sent = jiffies | 1; /* never 0 */ in __send_subscribe()
349 for (i = 0; i < ARRAY_SIZE(monc->subs); i++) { in __send_subscribe()
350 if (monc->subs[i].want) in __send_subscribe()
355 for (i = 0; i < ARRAY_SIZE(monc->subs); i++) { in __send_subscribe()
359 if (!monc->subs[i].want) in __send_subscribe()
364 monc->fs_cluster_id != CEPH_FS_CLUSTER_ID_NONE) in __send_subscribe()
365 len += sprintf(buf + len, ".%d", monc->fs_cluster_id); in __send_subscribe()
368 le64_to_cpu(monc->subs[i].item.start), in __send_subscribe()
369 monc->subs[i].item.flags); in __send_subscribe()
371 memcpy(p, &monc->subs[i].item, sizeof(monc->subs[i].item)); in __send_subscribe()
372 p += sizeof(monc->subs[i].item); in __send_subscribe()
379 ceph_con_send(&monc->con, ceph_msg_get(msg)); in __send_subscribe()
382 static void handle_subscribe_ack(struct ceph_mon_client *monc, in handle_subscribe_ack() argument
392 mutex_lock(&monc->mutex); in handle_subscribe_ack()
393 if (monc->sub_renew_sent) { in handle_subscribe_ack()
398 monc->sub_renew_after = monc->sub_renew_sent + in handle_subscribe_ack()
401 monc->sub_renew_sent, seconds, monc->sub_renew_after); in handle_subscribe_ack()
402 monc->sub_renew_sent = 0; in handle_subscribe_ack()
405 monc->sub_renew_sent, monc->sub_renew_after); in handle_subscribe_ack()
407 mutex_unlock(&monc->mutex); in handle_subscribe_ack()
420 static bool __ceph_monc_want_map(struct ceph_mon_client *monc, int sub, in __ceph_monc_want_map() argument
429 if (monc->subs[sub].want && in __ceph_monc_want_map()
430 monc->subs[sub].item.start == start && in __ceph_monc_want_map()
431 monc->subs[sub].item.flags == flags) in __ceph_monc_want_map()
434 monc->subs[sub].item.start = start; in __ceph_monc_want_map()
435 monc->subs[sub].item.flags = flags; in __ceph_monc_want_map()
436 monc->subs[sub].want = true; in __ceph_monc_want_map()
441 bool ceph_monc_want_map(struct ceph_mon_client *monc, int sub, u32 epoch, in ceph_monc_want_map() argument
446 mutex_lock(&monc->mutex); in ceph_monc_want_map()
447 need_request = __ceph_monc_want_map(monc, sub, epoch, continuous); in ceph_monc_want_map()
448 mutex_unlock(&monc->mutex); in ceph_monc_want_map()
459 static void __ceph_monc_got_map(struct ceph_mon_client *monc, int sub, in __ceph_monc_got_map() argument
464 if (monc->subs[sub].want) { in __ceph_monc_got_map()
465 if (monc->subs[sub].item.flags & CEPH_SUBSCRIBE_ONETIME) in __ceph_monc_got_map()
466 monc->subs[sub].want = false; in __ceph_monc_got_map()
468 monc->subs[sub].item.start = cpu_to_le64(epoch + 1); in __ceph_monc_got_map()
471 monc->subs[sub].have = epoch; in __ceph_monc_got_map()
474 void ceph_monc_got_map(struct ceph_mon_client *monc, int sub, u32 epoch) in ceph_monc_got_map() argument
476 mutex_lock(&monc->mutex); in ceph_monc_got_map()
477 __ceph_monc_got_map(monc, sub, epoch); in ceph_monc_got_map()
478 mutex_unlock(&monc->mutex); in ceph_monc_got_map()
482 void ceph_monc_renew_subs(struct ceph_mon_client *monc) in ceph_monc_renew_subs() argument
484 mutex_lock(&monc->mutex); in ceph_monc_renew_subs()
485 __send_subscribe(monc); in ceph_monc_renew_subs()
486 mutex_unlock(&monc->mutex); in ceph_monc_renew_subs()
496 int ceph_monc_wait_osdmap(struct ceph_mon_client *monc, u32 epoch, in ceph_monc_wait_osdmap() argument
502 mutex_lock(&monc->mutex); in ceph_monc_wait_osdmap()
503 while (monc->subs[CEPH_SUB_OSDMAP].have < epoch) { in ceph_monc_wait_osdmap()
504 mutex_unlock(&monc->mutex); in ceph_monc_wait_osdmap()
509 ret = wait_event_interruptible_timeout(monc->client->auth_wq, in ceph_monc_wait_osdmap()
510 monc->subs[CEPH_SUB_OSDMAP].have >= epoch, in ceph_monc_wait_osdmap()
515 mutex_lock(&monc->mutex); in ceph_monc_wait_osdmap()
518 mutex_unlock(&monc->mutex); in ceph_monc_wait_osdmap()
527 int ceph_monc_open_session(struct ceph_mon_client *monc) in ceph_monc_open_session() argument
529 mutex_lock(&monc->mutex); in ceph_monc_open_session()
530 __ceph_monc_want_map(monc, CEPH_SUB_MONMAP, 0, true); in ceph_monc_open_session()
531 __ceph_monc_want_map(monc, CEPH_SUB_OSDMAP, 0, false); in ceph_monc_open_session()
532 __open_session(monc); in ceph_monc_open_session()
533 __schedule_delayed(monc); in ceph_monc_open_session()
534 mutex_unlock(&monc->mutex); in ceph_monc_open_session()
539 static void ceph_monc_handle_map(struct ceph_mon_client *monc, in ceph_monc_handle_map() argument
542 struct ceph_client *client = monc->client; in ceph_monc_handle_map()
546 mutex_lock(&monc->mutex); in ceph_monc_handle_map()
565 kfree(monc->monmap); in ceph_monc_handle_map()
566 monc->monmap = monmap; in ceph_monc_handle_map()
568 __ceph_monc_got_map(monc, CEPH_SUB_MONMAP, monc->monmap->epoch); in ceph_monc_handle_map()
572 mutex_unlock(&monc->mutex); in ceph_monc_handle_map()
610 alloc_generic_request(struct ceph_mon_client *monc, gfp_t gfp) in alloc_generic_request() argument
618 req->monc = monc; in alloc_generic_request()
629 struct ceph_mon_client *monc = req->monc; in register_generic_request() local
634 req->tid = ++monc->last_tid; in register_generic_request()
635 insert_generic_request(&monc->generic_request_tree, req); in register_generic_request()
638 static void send_generic_request(struct ceph_mon_client *monc, in send_generic_request() argument
645 ceph_con_send(&monc->con, ceph_msg_get(req->request)); in send_generic_request()
650 struct ceph_mon_client *monc = req->monc; in __finish_generic_request() local
653 erase_generic_request(&monc->generic_request_tree, req); in __finish_generic_request()
676 struct ceph_mon_client *monc = req->monc; in cancel_generic_request() local
681 mutex_lock(&monc->mutex); in cancel_generic_request()
682 lookup_req = lookup_generic_request(&monc->generic_request_tree, in cancel_generic_request()
689 mutex_unlock(&monc->mutex); in cancel_generic_request()
710 struct ceph_mon_client *monc = con->private; in get_generic_reply() local
715 mutex_lock(&monc->mutex); in get_generic_reply()
716 req = lookup_generic_request(&monc->generic_request_tree, tid); in get_generic_reply()
731 mutex_unlock(&monc->mutex); in get_generic_reply()
738 static void handle_statfs_reply(struct ceph_mon_client *monc, in handle_statfs_reply() argument
750 mutex_lock(&monc->mutex); in handle_statfs_reply()
751 req = lookup_generic_request(&monc->generic_request_tree, tid); in handle_statfs_reply()
753 mutex_unlock(&monc->mutex); in handle_statfs_reply()
760 mutex_unlock(&monc->mutex); in handle_statfs_reply()
773 int ceph_monc_do_statfs(struct ceph_mon_client *monc, u64 data_pool, in ceph_monc_do_statfs() argument
780 req = alloc_generic_request(monc, GFP_NOFS); in ceph_monc_do_statfs()
796 mutex_lock(&monc->mutex); in ceph_monc_do_statfs()
803 h->fsid = monc->monmap->fsid; in ceph_monc_do_statfs()
806 send_generic_request(monc, req); in ceph_monc_do_statfs()
807 mutex_unlock(&monc->mutex); in ceph_monc_do_statfs()
816 static void handle_get_version_reply(struct ceph_mon_client *monc, in handle_get_version_reply() argument
832 mutex_lock(&monc->mutex); in handle_get_version_reply()
833 req = lookup_generic_request(&monc->generic_request_tree, handle); in handle_get_version_reply()
835 mutex_unlock(&monc->mutex); in handle_get_version_reply()
842 mutex_unlock(&monc->mutex); in handle_get_version_reply()
853 __ceph_monc_get_version(struct ceph_mon_client *monc, const char *what, in __ceph_monc_get_version() argument
858 req = alloc_generic_request(monc, GFP_NOIO); in __ceph_monc_get_version()
876 mutex_lock(&monc->mutex); in __ceph_monc_get_version()
886 send_generic_request(monc, req); in __ceph_monc_get_version()
887 mutex_unlock(&monc->mutex); in __ceph_monc_get_version()
901 int ceph_monc_get_version(struct ceph_mon_client *monc, const char *what, in ceph_monc_get_version() argument
907 req = __ceph_monc_get_version(monc, what, NULL, 0); in ceph_monc_get_version()
925 int ceph_monc_get_version_async(struct ceph_mon_client *monc, const char *what, in ceph_monc_get_version_async() argument
930 req = __ceph_monc_get_version(monc, what, cb, private_data); in ceph_monc_get_version_async()
939 static void handle_command_ack(struct ceph_mon_client *monc, in handle_command_ack() argument
953 mutex_lock(&monc->mutex); in handle_command_ack()
954 req = lookup_generic_request(&monc->generic_request_tree, tid); in handle_command_ack()
956 mutex_unlock(&monc->mutex); in handle_command_ack()
962 mutex_unlock(&monc->mutex); in handle_command_ack()
973 int do_mon_command_vargs(struct ceph_mon_client *monc, const char *fmt, in do_mon_command_vargs() argument
981 req = alloc_generic_request(monc, GFP_NOIO); in do_mon_command_vargs()
994 mutex_lock(&monc->mutex); in do_mon_command_vargs()
1000 h->fsid = monc->monmap->fsid; in do_mon_command_vargs()
1004 send_generic_request(monc, req); in do_mon_command_vargs()
1005 mutex_unlock(&monc->mutex); in do_mon_command_vargs()
1014 int do_mon_command(struct ceph_mon_client *monc, const char *fmt, ...) in do_mon_command() argument
1020 ret = do_mon_command_vargs(monc, fmt, ap); in do_mon_command()
1025 int ceph_monc_blocklist_add(struct ceph_mon_client *monc, in ceph_monc_blocklist_add() argument
1030 ret = do_mon_command(monc, in ceph_monc_blocklist_add()
1042 ret = do_mon_command(monc, in ceph_monc_blocklist_add()
1058 return ceph_wait_for_latest_osdmap(monc->client, 0); in ceph_monc_blocklist_add()
1065 static void __resend_generic_request(struct ceph_mon_client *monc) in __resend_generic_request() argument
1070 for (p = rb_first(&monc->generic_request_tree); p; p = rb_next(p)) { in __resend_generic_request()
1074 ceph_con_send(&monc->con, ceph_msg_get(req->request)); in __resend_generic_request()
1085 struct ceph_mon_client *monc = in delayed_work() local
1089 mutex_lock(&monc->mutex); in delayed_work()
1090 if (monc->hunting) { in delayed_work()
1092 reopen_session(monc); in delayed_work()
1094 int is_auth = ceph_auth_is_authenticated(monc->auth); in delayed_work()
1095 if (ceph_con_keepalive_expired(&monc->con, in delayed_work()
1099 reopen_session(monc); in delayed_work()
1102 if (!monc->hunting) { in delayed_work()
1103 ceph_con_keepalive(&monc->con); in delayed_work()
1104 __validate_auth(monc); in delayed_work()
1105 un_backoff(monc); in delayed_work()
1109 !(monc->con.peer_features & CEPH_FEATURE_MON_STATEFUL_SUB)) { in delayed_work()
1113 __func__, now, monc->sub_renew_after); in delayed_work()
1114 if (time_after_eq(now, monc->sub_renew_after)) in delayed_work()
1115 __send_subscribe(monc); in delayed_work()
1118 __schedule_delayed(monc); in delayed_work()
1119 mutex_unlock(&monc->mutex); in delayed_work()
1126 static int build_initial_monmap(struct ceph_mon_client *monc) in build_initial_monmap() argument
1128 __le32 my_type = ceph_msgr2(monc->client) ? in build_initial_monmap()
1130 struct ceph_options *opt = monc->client->options; in build_initial_monmap()
1135 monc->monmap = kzalloc(struct_size(monc->monmap, mon_inst, num_mon), in build_initial_monmap()
1137 if (!monc->monmap) in build_initial_monmap()
1141 struct ceph_entity_inst *inst = &monc->monmap->mon_inst[i]; in build_initial_monmap()
1150 monc->monmap->num_mon = num_mon; in build_initial_monmap()
1154 int ceph_monc_init(struct ceph_mon_client *monc, struct ceph_client *cl) in ceph_monc_init() argument
1159 memset(monc, 0, sizeof(*monc)); in ceph_monc_init()
1160 monc->client = cl; in ceph_monc_init()
1161 monc->monmap = NULL; in ceph_monc_init()
1162 mutex_init(&monc->mutex); in ceph_monc_init()
1164 err = build_initial_monmap(monc); in ceph_monc_init()
1170 monc->auth = ceph_auth_init(cl->options->name, cl->options->key, in ceph_monc_init()
1172 if (IS_ERR(monc->auth)) { in ceph_monc_init()
1173 err = PTR_ERR(monc->auth); in ceph_monc_init()
1176 monc->auth->want_keys = in ceph_monc_init()
1182 monc->m_subscribe_ack = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE_ACK, in ceph_monc_init()
1185 if (!monc->m_subscribe_ack) in ceph_monc_init()
1188 monc->m_subscribe = ceph_msg_new(CEPH_MSG_MON_SUBSCRIBE, 128, in ceph_monc_init()
1190 if (!monc->m_subscribe) in ceph_monc_init()
1193 monc->m_auth_reply = ceph_msg_new(CEPH_MSG_AUTH_REPLY, 4096, in ceph_monc_init()
1195 if (!monc->m_auth_reply) in ceph_monc_init()
1198 monc->m_auth = ceph_msg_new(CEPH_MSG_AUTH, 4096, GFP_KERNEL, true); in ceph_monc_init()
1199 monc->pending_auth = 0; in ceph_monc_init()
1200 if (!monc->m_auth) in ceph_monc_init()
1203 ceph_con_init(&monc->con, monc, &mon_con_ops, in ceph_monc_init()
1204 &monc->client->msgr); in ceph_monc_init()
1206 monc->cur_mon = -1; in ceph_monc_init()
1207 monc->had_a_connection = false; in ceph_monc_init()
1208 monc->hunt_mult = 1; in ceph_monc_init()
1210 INIT_DELAYED_WORK(&monc->delayed_work, delayed_work); in ceph_monc_init()
1211 monc->generic_request_tree = RB_ROOT; in ceph_monc_init()
1212 monc->last_tid = 0; in ceph_monc_init()
1214 monc->fs_cluster_id = CEPH_FS_CLUSTER_ID_NONE; in ceph_monc_init()
1219 ceph_msg_put(monc->m_auth_reply); in ceph_monc_init()
1221 ceph_msg_put(monc->m_subscribe); in ceph_monc_init()
1223 ceph_msg_put(monc->m_subscribe_ack); in ceph_monc_init()
1225 ceph_auth_destroy(monc->auth); in ceph_monc_init()
1227 kfree(monc->monmap); in ceph_monc_init()
1233 void ceph_monc_stop(struct ceph_mon_client *monc) in ceph_monc_stop() argument
1236 cancel_delayed_work_sync(&monc->delayed_work); in ceph_monc_stop()
1238 mutex_lock(&monc->mutex); in ceph_monc_stop()
1239 __close_session(monc); in ceph_monc_stop()
1240 monc->cur_mon = -1; in ceph_monc_stop()
1241 mutex_unlock(&monc->mutex); in ceph_monc_stop()
1251 ceph_auth_destroy(monc->auth); in ceph_monc_stop()
1253 WARN_ON(!RB_EMPTY_ROOT(&monc->generic_request_tree)); in ceph_monc_stop()
1255 ceph_msg_put(monc->m_auth); in ceph_monc_stop()
1256 ceph_msg_put(monc->m_auth_reply); in ceph_monc_stop()
1257 ceph_msg_put(monc->m_subscribe); in ceph_monc_stop()
1258 ceph_msg_put(monc->m_subscribe_ack); in ceph_monc_stop()
1260 kfree(monc->monmap); in ceph_monc_stop()
1264 static void finish_hunting(struct ceph_mon_client *monc) in finish_hunting() argument
1266 if (monc->hunting) { in finish_hunting()
1267 dout("%s found mon%d\n", __func__, monc->cur_mon); in finish_hunting()
1268 monc->hunting = false; in finish_hunting()
1269 monc->had_a_connection = true; in finish_hunting()
1270 un_backoff(monc); in finish_hunting()
1271 __schedule_delayed(monc); in finish_hunting()
1275 static void finish_auth(struct ceph_mon_client *monc, int auth_err, in finish_auth() argument
1281 monc->pending_auth = 0; in finish_auth()
1283 monc->client->auth_err = auth_err; in finish_auth()
1284 wake_up_all(&monc->client->auth_wq); in finish_auth()
1288 if (!was_authed && ceph_auth_is_authenticated(monc->auth)) { in finish_auth()
1290 __func__, monc->auth->global_id); in finish_auth()
1292 monc->client->msgr.inst.name.type = CEPH_ENTITY_TYPE_CLIENT; in finish_auth()
1293 monc->client->msgr.inst.name.num = in finish_auth()
1294 cpu_to_le64(monc->auth->global_id); in finish_auth()
1296 __send_subscribe(monc); in finish_auth()
1297 __resend_generic_request(monc); in finish_auth()
1299 pr_info("mon%d %s session established\n", monc->cur_mon, in finish_auth()
1300 ceph_pr_addr(&monc->con.peer_addr)); in finish_auth()
1304 static void handle_auth_reply(struct ceph_mon_client *monc, in handle_auth_reply() argument
1310 mutex_lock(&monc->mutex); in handle_auth_reply()
1311 was_authed = ceph_auth_is_authenticated(monc->auth); in handle_auth_reply()
1312 ret = ceph_handle_auth_reply(monc->auth, msg->front.iov_base, in handle_auth_reply()
1314 monc->m_auth->front.iov_base, in handle_auth_reply()
1315 monc->m_auth->front_alloc_len); in handle_auth_reply()
1317 __send_prepared_auth_request(monc, ret); in handle_auth_reply()
1319 finish_auth(monc, ret, was_authed); in handle_auth_reply()
1320 finish_hunting(monc); in handle_auth_reply()
1322 mutex_unlock(&monc->mutex); in handle_auth_reply()
1325 static int __validate_auth(struct ceph_mon_client *monc) in __validate_auth() argument
1329 if (monc->pending_auth) in __validate_auth()
1332 ret = ceph_build_auth(monc->auth, monc->m_auth->front.iov_base, in __validate_auth()
1333 monc->m_auth->front_alloc_len); in __validate_auth()
1336 __send_prepared_auth_request(monc, ret); in __validate_auth()
1340 int ceph_monc_validate_auth(struct ceph_mon_client *monc) in ceph_monc_validate_auth() argument
1344 mutex_lock(&monc->mutex); in ceph_monc_validate_auth()
1345 ret = __validate_auth(monc); in ceph_monc_validate_auth()
1346 mutex_unlock(&monc->mutex); in ceph_monc_validate_auth()
1355 struct ceph_mon_client *monc = con->private; in mon_get_auth_request() local
1358 mutex_lock(&monc->mutex); in mon_get_auth_request()
1359 ret = ceph_auth_get_request(monc->auth, buf, *buf_len); in mon_get_auth_request()
1360 mutex_unlock(&monc->mutex); in mon_get_auth_request()
1375 struct ceph_mon_client *monc = con->private; in mon_handle_auth_reply_more() local
1378 mutex_lock(&monc->mutex); in mon_handle_auth_reply_more()
1379 ret = ceph_auth_handle_reply_more(monc->auth, reply, reply_len, in mon_handle_auth_reply_more()
1381 mutex_unlock(&monc->mutex); in mon_handle_auth_reply_more()
1396 struct ceph_mon_client *monc = con->private; in mon_handle_auth_done() local
1400 mutex_lock(&monc->mutex); in mon_handle_auth_done()
1401 WARN_ON(!monc->hunting); in mon_handle_auth_done()
1402 was_authed = ceph_auth_is_authenticated(monc->auth); in mon_handle_auth_done()
1403 ret = ceph_auth_handle_reply_done(monc->auth, global_id, in mon_handle_auth_done()
1407 finish_auth(monc, ret, was_authed); in mon_handle_auth_done()
1409 finish_hunting(monc); in mon_handle_auth_done()
1410 mutex_unlock(&monc->mutex); in mon_handle_auth_done()
1419 struct ceph_mon_client *monc = con->private; in mon_handle_auth_bad_method() local
1422 mutex_lock(&monc->mutex); in mon_handle_auth_bad_method()
1423 WARN_ON(!monc->hunting); in mon_handle_auth_bad_method()
1424 was_authed = ceph_auth_is_authenticated(monc->auth); in mon_handle_auth_bad_method()
1425 ceph_auth_handle_bad_method(monc->auth, used_proto, result, in mon_handle_auth_bad_method()
1428 finish_auth(monc, -EACCES, was_authed); in mon_handle_auth_bad_method()
1429 mutex_unlock(&monc->mutex); in mon_handle_auth_bad_method()
1438 struct ceph_mon_client *monc = con->private; in mon_dispatch() local
1443 handle_auth_reply(monc, msg); in mon_dispatch()
1447 handle_subscribe_ack(monc, msg); in mon_dispatch()
1451 handle_statfs_reply(monc, msg); in mon_dispatch()
1455 handle_get_version_reply(monc, msg); in mon_dispatch()
1459 handle_command_ack(monc, msg); in mon_dispatch()
1463 ceph_monc_handle_map(monc, msg); in mon_dispatch()
1467 ceph_osdc_handle_map(&monc->client->osdc, msg); in mon_dispatch()
1472 if (monc->client->extra_mon_dispatch && in mon_dispatch()
1473 monc->client->extra_mon_dispatch(monc->client, msg) == 0) in mon_dispatch()
1489 struct ceph_mon_client *monc = con->private; in mon_alloc_msg() local
1498 m = ceph_msg_get(monc->m_subscribe_ack); in mon_alloc_msg()
1504 m = ceph_msg_get(monc->m_auth_reply); in mon_alloc_msg()
1547 struct ceph_mon_client *monc = con->private; in mon_fault() local
1549 mutex_lock(&monc->mutex); in mon_fault()
1550 dout("%s mon%d\n", __func__, monc->cur_mon); in mon_fault()
1551 if (monc->cur_mon >= 0) { in mon_fault()
1552 if (!monc->hunting) { in mon_fault()
1554 reopen_session(monc); in mon_fault()
1555 __schedule_delayed(monc); in mon_fault()
1560 mutex_unlock(&monc->mutex); in mon_fault()