Lines Matching refs:client
97 int ceph_check_fsid(struct ceph_client *client, struct ceph_fsid *fsid) in ceph_check_fsid() argument
99 if (client->have_fsid) { in ceph_check_fsid()
100 if (ceph_fsid_compare(&client->fsid, fsid)) { in ceph_check_fsid()
102 &client->fsid, fsid); in ceph_check_fsid()
106 memcpy(&client->fsid, fsid, sizeof(*fsid)); in ceph_check_fsid()
124 struct ceph_client *client) in ceph_compare_options() argument
127 struct ceph_options *opt2 = client->options; in ceph_compare_options()
136 if (!net_eq(current->nsproxy->net_ns, read_pnet(&client->msgr.net))) in ceph_compare_options()
173 if (ceph_monmap_contains(client->monc.monmap, in ceph_compare_options()
543 int ceph_print_client_options(struct seq_file *m, struct ceph_client *client) in ceph_print_client_options() argument
545 struct ceph_options *opt = client->options; in ceph_print_client_options()
590 struct ceph_entity_addr *ceph_client_addr(struct ceph_client *client) in ceph_client_addr() argument
592 return &client->msgr.inst.addr; in ceph_client_addr()
596 u64 ceph_client_gid(struct ceph_client *client) in ceph_client_gid() argument
598 return client->monc.auth->global_id; in ceph_client_gid()
607 struct ceph_client *client; in ceph_create_client() local
615 client = kzalloc(sizeof(*client), GFP_KERNEL); in ceph_create_client()
616 if (client == NULL) in ceph_create_client()
619 client->private = private; in ceph_create_client()
620 client->options = opt; in ceph_create_client()
622 mutex_init(&client->mount_mutex); in ceph_create_client()
623 init_waitqueue_head(&client->auth_wq); in ceph_create_client()
624 client->auth_err = 0; in ceph_create_client()
626 client->extra_mon_dispatch = NULL; in ceph_create_client()
627 client->supported_features = CEPH_FEATURES_SUPPORTED_DEFAULT; in ceph_create_client()
628 client->required_features = CEPH_FEATURES_REQUIRED_DEFAULT; in ceph_create_client()
630 if (!ceph_test_opt(client, NOMSGAUTH)) in ceph_create_client()
631 client->required_features |= CEPH_FEATURE_MSG_AUTH; in ceph_create_client()
634 if (ceph_test_opt(client, MYIP)) in ceph_create_client()
635 myaddr = &client->options->my_addr; in ceph_create_client()
637 ceph_messenger_init(&client->msgr, myaddr); in ceph_create_client()
640 err = ceph_monc_init(&client->monc, client); in ceph_create_client()
643 err = ceph_osdc_init(&client->osdc, client); in ceph_create_client()
647 return client; in ceph_create_client()
650 ceph_monc_stop(&client->monc); in ceph_create_client()
652 ceph_messenger_fini(&client->msgr); in ceph_create_client()
653 kfree(client); in ceph_create_client()
658 void ceph_destroy_client(struct ceph_client *client) in ceph_destroy_client() argument
660 dout("destroy_client %p\n", client); in ceph_destroy_client()
662 atomic_set(&client->msgr.stopping, 1); in ceph_destroy_client()
665 ceph_osdc_stop(&client->osdc); in ceph_destroy_client()
666 ceph_monc_stop(&client->monc); in ceph_destroy_client()
667 ceph_messenger_fini(&client->msgr); in ceph_destroy_client()
669 ceph_debugfs_client_cleanup(client); in ceph_destroy_client()
671 ceph_destroy_options(client->options); in ceph_destroy_client()
673 kfree(client); in ceph_destroy_client()
674 dout("destroy_client %p done\n", client); in ceph_destroy_client()
681 static bool have_mon_and_osd_map(struct ceph_client *client) in have_mon_and_osd_map() argument
683 return client->monc.monmap && client->monc.monmap->epoch && in have_mon_and_osd_map()
684 client->osdc.osdmap && client->osdc.osdmap->epoch; in have_mon_and_osd_map()
690 int __ceph_open_session(struct ceph_client *client, unsigned long started) in __ceph_open_session() argument
692 unsigned long timeout = client->options->mount_timeout; in __ceph_open_session()
696 err = ceph_monc_open_session(&client->monc); in __ceph_open_session()
700 while (!have_mon_and_osd_map(client)) { in __ceph_open_session()
706 err = wait_event_interruptible_timeout(client->auth_wq, in __ceph_open_session()
707 have_mon_and_osd_map(client) || (client->auth_err < 0), in __ceph_open_session()
711 if (client->auth_err < 0) in __ceph_open_session()
712 return client->auth_err; in __ceph_open_session()
715 pr_info("client%llu fsid %pU\n", ceph_client_gid(client), in __ceph_open_session()
716 &client->fsid); in __ceph_open_session()
717 ceph_debugfs_client_init(client); in __ceph_open_session()
723 int ceph_open_session(struct ceph_client *client) in ceph_open_session() argument
729 mutex_lock(&client->mount_mutex); in ceph_open_session()
731 ret = __ceph_open_session(client, started); in ceph_open_session()
733 mutex_unlock(&client->mount_mutex); in ceph_open_session()
738 int ceph_wait_for_latest_osdmap(struct ceph_client *client, in ceph_wait_for_latest_osdmap() argument
744 ret = ceph_monc_get_version(&client->monc, "osdmap", &newest_epoch); in ceph_wait_for_latest_osdmap()
748 if (client->osdc.osdmap->epoch >= newest_epoch) in ceph_wait_for_latest_osdmap()
751 ceph_osdc_maybe_request_map(&client->osdc); in ceph_wait_for_latest_osdmap()
752 return ceph_monc_wait_osdmap(&client->monc, newest_epoch, timeout); in ceph_wait_for_latest_osdmap()