ceph的rbd.ko libceph.ko文件

rbd.c
rbd 在内核的linux-3.13.8/drivers/block目录下。
模块的初始化文件为rbd_init.
5321 module_init(rbd_init);
5322 module_exit(rbd_exit);

rbd_slab_init kmem_cache_create 从 kmem_cache 中获取一个缓存器描述符,并且根据参数初始化一些必要字段。

rbd_sysfs_init->device_register
		->bus_register
static struct device rbd_root_dev = {
     .init_name =    "rbd",
     .release =      rbd_root_dev_release,
};   

调用流程

rbd_add->rbd_add_parse_args->ceph_parse_options  -> ceph_parse_ips 
						 ->match_token->parse_extra_token 
						 ->get_secret->(request_key,ceph_crypto_key_clone)
		->rbd_dev_create
		->rbd_dev_image_probe ->rbd_dev_header_watch_sync ->rbd_obj_request_create
								->rbd_osd_req_create->ceph_osdc_alloc_request->ceph_msg_new
	

libceph.ko

44 module_init(init_ceph_lib);
645 module_exit(exit_ceph_lib);

init_ceph_lib ->ceph_crypto_init->register_key_type;

key_type_ceph 结构体

484 struct key_type key_type_ceph = {
485     .name       = "ceph",
486     .instantiate    = ceph_key_instantiate,
487     .match      = ceph_key_match,
488     .destroy    = ceph_key_destroy,
489 };

ceph_key_instantiate->ceph_crypto_key_decode

660 static const struct ceph_auth_client_ops ceph_x_ops = {
661     .name = "x",
662     .is_authenticated = ceph_x_is_authenticated,
663     .should_authenticate = ceph_x_should_authenticate,
664     .build_request = ceph_x_build_request,
665     .handle_reply = ceph_x_handle_reply,                                                                                          
666     .create_authorizer = ceph_x_create_authorizer,
667     .update_authorizer = ceph_x_update_authorizer,
668     .verify_authorizer_reply = ceph_x_verify_authorizer_reply,
669     .destroy_authorizer = ceph_x_destroy_authorizer,
670     .invalidate_authorizer = ceph_x_invalidate_authorizer,
671     .reset =  ceph_x_reset,
672     .destroy = ceph_x_destroy,
673 };

ceph涉及AES加密流程:

dispatch->handle_auth_reply
        ->ceph_handle_auth_reply
        ->ceph_x_handle_reply
        ->ceph_x_proc_ticket_reply
        ->ceph_x_decrypt
        ->ceph_decrypt2
        ->ceph_aes_decrypt2

发表评论

您的电子邮箱地址不会被公开。