diff options
| -rw-r--r-- | drivers/block/rbd.c | 2 | ||||
| -rw-r--r-- | fs/ceph/super.c | 9 | ||||
| -rw-r--r-- | include/linux/ceph/libceph.h | 4 | ||||
| -rw-r--r-- | net/ceph/ceph_common.c | 47 |
4 files changed, 34 insertions, 28 deletions
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c index 15f65b5f3fc..0b3c5663a18 100644 --- a/drivers/block/rbd.c +++ b/drivers/block/rbd.c | |||
| @@ -260,7 +260,7 @@ static struct rbd_client *rbd_client_create(struct ceph_options *opt, | |||
| 260 | kref_init(&rbdc->kref); | 260 | kref_init(&rbdc->kref); |
| 261 | INIT_LIST_HEAD(&rbdc->node); | 261 | INIT_LIST_HEAD(&rbdc->node); |
| 262 | 262 | ||
| 263 | rbdc->client = ceph_create_client(opt, rbdc); | 263 | rbdc->client = ceph_create_client(opt, rbdc, 0, 0); |
| 264 | if (IS_ERR(rbdc->client)) | 264 | if (IS_ERR(rbdc->client)) |
| 265 | goto out_rbdc; | 265 | goto out_rbdc; |
| 266 | opt = NULL; /* Now rbdc->client is responsible for opt */ | 266 | opt = NULL; /* Now rbdc->client is responsible for opt */ |
diff --git a/fs/ceph/super.c b/fs/ceph/super.c index 387addbf942..f90dc0b011a 100644 --- a/fs/ceph/super.c +++ b/fs/ceph/super.c | |||
| @@ -430,20 +430,23 @@ struct ceph_fs_client *create_fs_client(struct ceph_mount_options *fsopt, | |||
| 430 | struct ceph_options *opt) | 430 | struct ceph_options *opt) |
| 431 | { | 431 | { |
| 432 | struct ceph_fs_client *fsc; | 432 | struct ceph_fs_client *fsc; |
| 433 | const unsigned supported_features = | ||
| 434 | CEPH_FEATURE_FLOCK | | ||
| 435 | CEPH_FEATURE_DIRLAYOUTHASH; | ||
| 436 | const unsigned required_features = 0; | ||
| 433 | int err = -ENOMEM; | 437 | int err = -ENOMEM; |
| 434 | 438 | ||
| 435 | fsc = kzalloc(sizeof(*fsc), GFP_KERNEL); | 439 | fsc = kzalloc(sizeof(*fsc), GFP_KERNEL); |
| 436 | if (!fsc) | 440 | if (!fsc) |
| 437 | return ERR_PTR(-ENOMEM); | 441 | return ERR_PTR(-ENOMEM); |
| 438 | 442 | ||
| 439 | fsc->client = ceph_create_client(opt, fsc); | 443 | fsc->client = ceph_create_client(opt, fsc, supported_features, |
| 444 | required_features); | ||
| 440 | if (IS_ERR(fsc->client)) { | 445 | if (IS_ERR(fsc->client)) { |
| 441 | err = PTR_ERR(fsc->client); | 446 | err = PTR_ERR(fsc->client); |
| 442 | goto fail; | 447 | goto fail; |
| 443 | } | 448 | } |
| 444 | fsc->client->extra_mon_dispatch = extra_mon_dispatch; | 449 | fsc->client->extra_mon_dispatch = extra_mon_dispatch; |
| 445 | fsc->client->supported_features |= CEPH_FEATURE_FLOCK | | ||
| 446 | CEPH_FEATURE_DIRLAYOUTHASH; | ||
| 447 | fsc->client->monc.want_mdsmap = 1; | 450 | fsc->client->monc.want_mdsmap = 1; |
| 448 | 451 | ||
| 449 | fsc->mount_options = fsopt; | 452 | fsc->mount_options = fsopt; |
diff --git a/include/linux/ceph/libceph.h b/include/linux/ceph/libceph.h index 563755181c1..95bd8502e71 100644 --- a/include/linux/ceph/libceph.h +++ b/include/linux/ceph/libceph.h | |||
| @@ -215,7 +215,9 @@ extern void ceph_destroy_options(struct ceph_options *opt); | |||
| 215 | extern int ceph_compare_options(struct ceph_options *new_opt, | 215 | extern int ceph_compare_options(struct ceph_options *new_opt, |
| 216 | struct ceph_client *client); | 216 | struct ceph_client *client); |
| 217 | extern struct ceph_client *ceph_create_client(struct ceph_options *opt, | 217 | extern struct ceph_client *ceph_create_client(struct ceph_options *opt, |
| 218 | void *private); | 218 | void *private, |
| 219 | unsigned supported_features, | ||
| 220 | unsigned required_features); | ||
| 219 | extern u64 ceph_client_id(struct ceph_client *client); | 221 | extern u64 ceph_client_id(struct ceph_client *client); |
| 220 | extern void ceph_destroy_client(struct ceph_client *client); | 222 | extern void ceph_destroy_client(struct ceph_client *client); |
| 221 | extern int __ceph_open_session(struct ceph_client *client, | 223 | extern int __ceph_open_session(struct ceph_client *client, |
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 2883ea01e68..97f70e50ad3 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c | |||
| @@ -432,9 +432,12 @@ EXPORT_SYMBOL(ceph_client_id); | |||
| 432 | /* | 432 | /* |
| 433 | * create a fresh client instance | 433 | * create a fresh client instance |
| 434 | */ | 434 | */ |
| 435 | struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) | 435 | struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, |
| 436 | unsigned supported_features, | ||
| 437 | unsigned required_features) | ||
| 436 | { | 438 | { |
| 437 | struct ceph_client *client; | 439 | struct ceph_client *client; |
| 440 | struct ceph_entity_addr *myaddr = NULL; | ||
| 438 | int err = -ENOMEM; | 441 | int err = -ENOMEM; |
| 439 | 442 | ||
| 440 | client = kzalloc(sizeof(*client), GFP_KERNEL); | 443 | client = kzalloc(sizeof(*client), GFP_KERNEL); |
| @@ -449,15 +452,27 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) | |||
| 449 | client->auth_err = 0; | 452 | client->auth_err = 0; |
| 450 | 453 | ||
| 451 | client->extra_mon_dispatch = NULL; | 454 | client->extra_mon_dispatch = NULL; |
| 452 | client->supported_features = CEPH_FEATURE_SUPPORTED_DEFAULT; | 455 | client->supported_features = CEPH_FEATURE_SUPPORTED_DEFAULT | |
| 453 | client->required_features = CEPH_FEATURE_REQUIRED_DEFAULT; | 456 | supported_features; |
| 454 | 457 | client->required_features = CEPH_FEATURE_REQUIRED_DEFAULT | | |
| 455 | client->msgr = NULL; | 458 | required_features; |
| 459 | |||
| 460 | /* msgr */ | ||
| 461 | if (ceph_test_opt(client, MYIP)) | ||
| 462 | myaddr = &client->options->my_addr; | ||
| 463 | client->msgr = ceph_messenger_create(myaddr, | ||
| 464 | client->supported_features, | ||
| 465 | client->required_features); | ||
| 466 | if (IS_ERR(client->msgr)) { | ||
| 467 | err = PTR_ERR(client->msgr); | ||
| 468 | goto fail; | ||
| 469 | } | ||
| 470 | client->msgr->nocrc = ceph_test_opt(client, NOCRC); | ||
| 456 | 471 | ||
| 457 | /* subsystems */ | 472 | /* subsystems */ |
| 458 | err = ceph_monc_init(&client->monc, client); | 473 | err = ceph_monc_init(&client->monc, client); |
| 459 | if (err < 0) | 474 | if (err < 0) |
| 460 | goto fail; | 475 | goto fail_msgr; |
| 461 | err = ceph_osdc_init(&client->osdc, client); | 476 | err = ceph_osdc_init(&client->osdc, client); |
| 462 | if (err < 0) | 477 | if (err < 0) |
| 463 | goto fail_monc; | 478 | goto fail_monc; |
| @@ -466,6 +481,8 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private) | |||
| 466 | 481 | ||
| 467 | fail_monc: | 482 | fail_monc: |
| 468 | ceph_monc_stop(&client->monc); | 483 | ceph_monc_stop(&client->monc); |
| 484 | fail_msgr: | ||
| 485 | ceph_messenger_destroy(client->msgr); | ||
| 469 | fail: | 486 | fail: |
| 470 | kfree(client); | 487 | kfree(client); |
| 471 | return ERR_PTR(err); | 488 | return ERR_PTR(err); |
| @@ -490,8 +507,7 @@ void ceph_destroy_client(struct ceph_client *client) | |||
| 490 | 507 | ||
| 491 | ceph_debugfs_client_cleanup(client); | 508 | ceph_debugfs_client_cleanup(client); |
| 492 | 509 | ||
| 493 | if (client->msgr) | 510 | ceph_messenger_destroy(client->msgr); |
| 494 | ceph_messenger_destroy(client->msgr); | ||
| 495 | 511 | ||
| 496 | ceph_destroy_options(client->options); | 512 | ceph_destroy_options(client->options); |
| 497 | 513 | ||
| @@ -514,24 +530,9 @@ static int have_mon_and_osd_map(struct ceph_client *client) | |||
| 514 | */ | 530 | */ |
| 515 | int __ceph_open_session(struct ceph_client *client, unsigned long started) | 531 | int __ceph_open_session(struct ceph_client *client, unsigned long started) |
| 516 | { | 532 | { |
| 517 | struct ceph_entity_addr *myaddr = NULL; | ||
| 518 | int err; | 533 | int err; |
| 519 | unsigned long timeout = client->options->mount_timeout * HZ; | 534 | unsigned long timeout = client->options->mount_timeout * HZ; |
| 520 | 535 | ||
| 521 | /* initialize the messenger */ | ||
| 522 | if (client->msgr == NULL) { | ||
| 523 | if (ceph_test_opt(client, MYIP)) | ||
| 524 | myaddr = &client->options->my_addr; | ||
| 525 | client->msgr = ceph_messenger_create(myaddr, | ||
| 526 | client->supported_features, | ||
| 527 | client->required_features); | ||
| 528 | if (IS_ERR(client->msgr)) { | ||
| 529 | client->msgr = NULL; | ||
| 530 | return PTR_ERR(client->msgr); | ||
| 531 | } | ||
| 532 | client->msgr->nocrc = ceph_test_opt(client, NOCRC); | ||
| 533 | } | ||
| 534 | |||
| 535 | /* open session, and wait for mon and osd maps */ | 536 | /* open session, and wait for mon and osd maps */ |
| 536 | err = ceph_monc_open_session(&client->monc); | 537 | err = ceph_monc_open_session(&client->monc); |
| 537 | if (err < 0) | 538 | if (err < 0) |
