|
@@ -432,9 +432,12 @@ EXPORT_SYMBOL(ceph_client_id);
|
|
|
/*
|
|
|
* create a fresh client instance
|
|
|
*/
|
|
|
-struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
|
|
|
+struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private,
|
|
|
+ unsigned supported_features,
|
|
|
+ unsigned required_features)
|
|
|
{
|
|
|
struct ceph_client *client;
|
|
|
+ struct ceph_entity_addr *myaddr = NULL;
|
|
|
int err = -ENOMEM;
|
|
|
|
|
|
client = kzalloc(sizeof(*client), GFP_KERNEL);
|
|
@@ -449,15 +452,27 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
|
|
|
client->auth_err = 0;
|
|
|
|
|
|
client->extra_mon_dispatch = NULL;
|
|
|
- client->supported_features = CEPH_FEATURE_SUPPORTED_DEFAULT;
|
|
|
- client->required_features = CEPH_FEATURE_REQUIRED_DEFAULT;
|
|
|
-
|
|
|
- client->msgr = NULL;
|
|
|
+ client->supported_features = CEPH_FEATURE_SUPPORTED_DEFAULT |
|
|
|
+ supported_features;
|
|
|
+ client->required_features = CEPH_FEATURE_REQUIRED_DEFAULT |
|
|
|
+ required_features;
|
|
|
+
|
|
|
+ /* msgr */
|
|
|
+ if (ceph_test_opt(client, MYIP))
|
|
|
+ myaddr = &client->options->my_addr;
|
|
|
+ client->msgr = ceph_messenger_create(myaddr,
|
|
|
+ client->supported_features,
|
|
|
+ client->required_features);
|
|
|
+ if (IS_ERR(client->msgr)) {
|
|
|
+ err = PTR_ERR(client->msgr);
|
|
|
+ goto fail;
|
|
|
+ }
|
|
|
+ client->msgr->nocrc = ceph_test_opt(client, NOCRC);
|
|
|
|
|
|
/* subsystems */
|
|
|
err = ceph_monc_init(&client->monc, client);
|
|
|
if (err < 0)
|
|
|
- goto fail;
|
|
|
+ goto fail_msgr;
|
|
|
err = ceph_osdc_init(&client->osdc, client);
|
|
|
if (err < 0)
|
|
|
goto fail_monc;
|
|
@@ -466,6 +481,8 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private)
|
|
|
|
|
|
fail_monc:
|
|
|
ceph_monc_stop(&client->monc);
|
|
|
+fail_msgr:
|
|
|
+ ceph_messenger_destroy(client->msgr);
|
|
|
fail:
|
|
|
kfree(client);
|
|
|
return ERR_PTR(err);
|
|
@@ -490,8 +507,7 @@ void ceph_destroy_client(struct ceph_client *client)
|
|
|
|
|
|
ceph_debugfs_client_cleanup(client);
|
|
|
|
|
|
- if (client->msgr)
|
|
|
- ceph_messenger_destroy(client->msgr);
|
|
|
+ ceph_messenger_destroy(client->msgr);
|
|
|
|
|
|
ceph_destroy_options(client->options);
|
|
|
|
|
@@ -514,24 +530,9 @@ static int have_mon_and_osd_map(struct ceph_client *client)
|
|
|
*/
|
|
|
int __ceph_open_session(struct ceph_client *client, unsigned long started)
|
|
|
{
|
|
|
- struct ceph_entity_addr *myaddr = NULL;
|
|
|
int err;
|
|
|
unsigned long timeout = client->options->mount_timeout * HZ;
|
|
|
|
|
|
- /* initialize the messenger */
|
|
|
- if (client->msgr == NULL) {
|
|
|
- if (ceph_test_opt(client, MYIP))
|
|
|
- myaddr = &client->options->my_addr;
|
|
|
- client->msgr = ceph_messenger_create(myaddr,
|
|
|
- client->supported_features,
|
|
|
- client->required_features);
|
|
|
- if (IS_ERR(client->msgr)) {
|
|
|
- client->msgr = NULL;
|
|
|
- return PTR_ERR(client->msgr);
|
|
|
- }
|
|
|
- client->msgr->nocrc = ceph_test_opt(client, NOCRC);
|
|
|
- }
|
|
|
-
|
|
|
/* open session, and wait for mon and osd maps */
|
|
|
err = ceph_monc_open_session(&client->monc);
|
|
|
if (err < 0)
|