diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/ceph/ceph_common.c | 16 | ||||
| -rw-r--r-- | net/ceph/ceph_strings.c | 14 | ||||
| -rw-r--r-- | net/ceph/debugfs.c | 2 | ||||
| -rw-r--r-- | net/ceph/messenger.c | 14 | ||||
| -rw-r--r-- | net/ceph/mon_client.c | 139 | ||||
| -rw-r--r-- | net/ceph/osd_client.c | 31 |
6 files changed, 54 insertions, 162 deletions
diff --git a/net/ceph/ceph_common.c b/net/ceph/ceph_common.c index 5d5ab67f516d..ec565508e904 100644 --- a/net/ceph/ceph_common.c +++ b/net/ceph/ceph_common.c | |||
| @@ -239,6 +239,8 @@ enum { | |||
| 239 | Opt_nocrc, | 239 | Opt_nocrc, |
| 240 | Opt_cephx_require_signatures, | 240 | Opt_cephx_require_signatures, |
| 241 | Opt_nocephx_require_signatures, | 241 | Opt_nocephx_require_signatures, |
| 242 | Opt_tcp_nodelay, | ||
| 243 | Opt_notcp_nodelay, | ||
| 242 | }; | 244 | }; |
| 243 | 245 | ||
| 244 | static match_table_t opt_tokens = { | 246 | static match_table_t opt_tokens = { |
| @@ -259,6 +261,8 @@ static match_table_t opt_tokens = { | |||
| 259 | {Opt_nocrc, "nocrc"}, | 261 | {Opt_nocrc, "nocrc"}, |
| 260 | {Opt_cephx_require_signatures, "cephx_require_signatures"}, | 262 | {Opt_cephx_require_signatures, "cephx_require_signatures"}, |
| 261 | {Opt_nocephx_require_signatures, "nocephx_require_signatures"}, | 263 | {Opt_nocephx_require_signatures, "nocephx_require_signatures"}, |
| 264 | {Opt_tcp_nodelay, "tcp_nodelay"}, | ||
| 265 | {Opt_notcp_nodelay, "notcp_nodelay"}, | ||
| 262 | {-1, NULL} | 266 | {-1, NULL} |
| 263 | }; | 267 | }; |
| 264 | 268 | ||
| @@ -457,6 +461,7 @@ ceph_parse_options(char *options, const char *dev_name, | |||
| 457 | case Opt_nocrc: | 461 | case Opt_nocrc: |
| 458 | opt->flags |= CEPH_OPT_NOCRC; | 462 | opt->flags |= CEPH_OPT_NOCRC; |
| 459 | break; | 463 | break; |
| 464 | |||
| 460 | case Opt_cephx_require_signatures: | 465 | case Opt_cephx_require_signatures: |
| 461 | opt->flags &= ~CEPH_OPT_NOMSGAUTH; | 466 | opt->flags &= ~CEPH_OPT_NOMSGAUTH; |
| 462 | break; | 467 | break; |
| @@ -464,6 +469,13 @@ ceph_parse_options(char *options, const char *dev_name, | |||
| 464 | opt->flags |= CEPH_OPT_NOMSGAUTH; | 469 | opt->flags |= CEPH_OPT_NOMSGAUTH; |
| 465 | break; | 470 | break; |
| 466 | 471 | ||
| 472 | case Opt_tcp_nodelay: | ||
| 473 | opt->flags |= CEPH_OPT_TCP_NODELAY; | ||
| 474 | break; | ||
| 475 | case Opt_notcp_nodelay: | ||
| 476 | opt->flags &= ~CEPH_OPT_TCP_NODELAY; | ||
| 477 | break; | ||
| 478 | |||
| 467 | default: | 479 | default: |
| 468 | BUG_ON(token); | 480 | BUG_ON(token); |
| 469 | } | 481 | } |
| @@ -518,10 +530,12 @@ struct ceph_client *ceph_create_client(struct ceph_options *opt, void *private, | |||
| 518 | /* msgr */ | 530 | /* msgr */ |
| 519 | if (ceph_test_opt(client, MYIP)) | 531 | if (ceph_test_opt(client, MYIP)) |
| 520 | myaddr = &client->options->my_addr; | 532 | myaddr = &client->options->my_addr; |
| 533 | |||
| 521 | ceph_messenger_init(&client->msgr, myaddr, | 534 | ceph_messenger_init(&client->msgr, myaddr, |
| 522 | client->supported_features, | 535 | client->supported_features, |
| 523 | client->required_features, | 536 | client->required_features, |
| 524 | ceph_test_opt(client, NOCRC)); | 537 | ceph_test_opt(client, NOCRC), |
| 538 | ceph_test_opt(client, TCP_NODELAY)); | ||
| 525 | 539 | ||
| 526 | /* subsystems */ | 540 | /* subsystems */ |
| 527 | err = ceph_monc_init(&client->monc, client); | 541 | err = ceph_monc_init(&client->monc, client); |
diff --git a/net/ceph/ceph_strings.c b/net/ceph/ceph_strings.c index 30560202f57b..139a9cb19b0c 100644 --- a/net/ceph/ceph_strings.c +++ b/net/ceph/ceph_strings.c | |||
| @@ -42,17 +42,3 @@ const char *ceph_osd_state_name(int s) | |||
| 42 | return "???"; | 42 | return "???"; |
| 43 | } | 43 | } |
| 44 | } | 44 | } |
| 45 | |||
| 46 | const char *ceph_pool_op_name(int op) | ||
| 47 | { | ||
| 48 | switch (op) { | ||
| 49 | case POOL_OP_CREATE: return "create"; | ||
| 50 | case POOL_OP_DELETE: return "delete"; | ||
| 51 | case POOL_OP_AUID_CHANGE: return "auid change"; | ||
| 52 | case POOL_OP_CREATE_SNAP: return "create snap"; | ||
| 53 | case POOL_OP_DELETE_SNAP: return "delete snap"; | ||
| 54 | case POOL_OP_CREATE_UNMANAGED_SNAP: return "create unmanaged snap"; | ||
| 55 | case POOL_OP_DELETE_UNMANAGED_SNAP: return "delete unmanaged snap"; | ||
| 56 | } | ||
| 57 | return "???"; | ||
| 58 | } | ||
diff --git a/net/ceph/debugfs.c b/net/ceph/debugfs.c index d2d525529f87..14d9995097cc 100644 --- a/net/ceph/debugfs.c +++ b/net/ceph/debugfs.c | |||
| @@ -127,8 +127,6 @@ static int monc_show(struct seq_file *s, void *p) | |||
| 127 | op = le16_to_cpu(req->request->hdr.type); | 127 | op = le16_to_cpu(req->request->hdr.type); |
| 128 | if (op == CEPH_MSG_STATFS) | 128 | if (op == CEPH_MSG_STATFS) |
| 129 | seq_printf(s, "%llu statfs\n", req->tid); | 129 | seq_printf(s, "%llu statfs\n", req->tid); |
| 130 | else if (op == CEPH_MSG_POOLOP) | ||
| 131 | seq_printf(s, "%llu poolop\n", req->tid); | ||
| 132 | else if (op == CEPH_MSG_MON_GET_VERSION) | 130 | else if (op == CEPH_MSG_MON_GET_VERSION) |
| 133 | seq_printf(s, "%llu mon_get_version", req->tid); | 131 | seq_printf(s, "%llu mon_get_version", req->tid); |
| 134 | else | 132 | else |
diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c index 33a2f201e460..6b3f54ed65ba 100644 --- a/net/ceph/messenger.c +++ b/net/ceph/messenger.c | |||
| @@ -510,6 +510,16 @@ static int ceph_tcp_connect(struct ceph_connection *con) | |||
| 510 | return ret; | 510 | return ret; |
| 511 | } | 511 | } |
| 512 | 512 | ||
| 513 | if (con->msgr->tcp_nodelay) { | ||
| 514 | int optval = 1; | ||
| 515 | |||
| 516 | ret = kernel_setsockopt(sock, SOL_TCP, TCP_NODELAY, | ||
| 517 | (char *)&optval, sizeof(optval)); | ||
| 518 | if (ret) | ||
| 519 | pr_err("kernel_setsockopt(TCP_NODELAY) failed: %d", | ||
| 520 | ret); | ||
| 521 | } | ||
| 522 | |||
| 513 | sk_set_memalloc(sock->sk); | 523 | sk_set_memalloc(sock->sk); |
| 514 | 524 | ||
| 515 | con->sock = sock; | 525 | con->sock = sock; |
| @@ -2922,7 +2932,8 @@ void ceph_messenger_init(struct ceph_messenger *msgr, | |||
| 2922 | struct ceph_entity_addr *myaddr, | 2932 | struct ceph_entity_addr *myaddr, |
| 2923 | u64 supported_features, | 2933 | u64 supported_features, |
| 2924 | u64 required_features, | 2934 | u64 required_features, |
| 2925 | bool nocrc) | 2935 | bool nocrc, |
| 2936 | bool tcp_nodelay) | ||
| 2926 | { | 2937 | { |
| 2927 | msgr->supported_features = supported_features; | 2938 | msgr->supported_features = supported_features; |
| 2928 | msgr->required_features = required_features; | 2939 | msgr->required_features = required_features; |
| @@ -2937,6 +2948,7 @@ void ceph_messenger_init(struct ceph_messenger *msgr, | |||
| 2937 | get_random_bytes(&msgr->inst.addr.nonce, sizeof(msgr->inst.addr.nonce)); | 2948 | get_random_bytes(&msgr->inst.addr.nonce, sizeof(msgr->inst.addr.nonce)); |
| 2938 | encode_my_addr(msgr); | 2949 | encode_my_addr(msgr); |
| 2939 | msgr->nocrc = nocrc; | 2950 | msgr->nocrc = nocrc; |
| 2951 | msgr->tcp_nodelay = tcp_nodelay; | ||
| 2940 | 2952 | ||
| 2941 | atomic_set(&msgr->stopping, 0); | 2953 | atomic_set(&msgr->stopping, 0); |
| 2942 | 2954 | ||
diff --git a/net/ceph/mon_client.c b/net/ceph/mon_client.c index f2148e22b148..2b3cf05e87b0 100644 --- a/net/ceph/mon_client.c +++ b/net/ceph/mon_client.c | |||
| @@ -410,7 +410,7 @@ out_unlocked: | |||
| 410 | } | 410 | } |
| 411 | 411 | ||
| 412 | /* | 412 | /* |
| 413 | * generic requests (e.g., statfs, poolop) | 413 | * generic requests (currently statfs, mon_get_version) |
| 414 | */ | 414 | */ |
| 415 | static struct ceph_mon_generic_request *__lookup_generic_req( | 415 | static struct ceph_mon_generic_request *__lookup_generic_req( |
| 416 | struct ceph_mon_client *monc, u64 tid) | 416 | struct ceph_mon_client *monc, u64 tid) |
| @@ -569,7 +569,7 @@ static void handle_statfs_reply(struct ceph_mon_client *monc, | |||
| 569 | return; | 569 | return; |
| 570 | 570 | ||
| 571 | bad: | 571 | bad: |
| 572 | pr_err("corrupt generic reply, tid %llu\n", tid); | 572 | pr_err("corrupt statfs reply, tid %llu\n", tid); |
| 573 | ceph_msg_dump(msg); | 573 | ceph_msg_dump(msg); |
| 574 | } | 574 | } |
| 575 | 575 | ||
| @@ -588,7 +588,6 @@ int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf) | |||
| 588 | 588 | ||
| 589 | kref_init(&req->kref); | 589 | kref_init(&req->kref); |
| 590 | req->buf = buf; | 590 | req->buf = buf; |
| 591 | req->buf_len = sizeof(*buf); | ||
| 592 | init_completion(&req->completion); | 591 | init_completion(&req->completion); |
| 593 | 592 | ||
| 594 | err = -ENOMEM; | 593 | err = -ENOMEM; |
| @@ -611,7 +610,7 @@ int ceph_monc_do_statfs(struct ceph_mon_client *monc, struct ceph_statfs *buf) | |||
| 611 | err = do_generic_request(monc, req); | 610 | err = do_generic_request(monc, req); |
| 612 | 611 | ||
| 613 | out: | 612 | out: |
| 614 | kref_put(&req->kref, release_generic_request); | 613 | put_generic_request(req); |
| 615 | return err; | 614 | return err; |
| 616 | } | 615 | } |
| 617 | EXPORT_SYMBOL(ceph_monc_do_statfs); | 616 | EXPORT_SYMBOL(ceph_monc_do_statfs); |
| @@ -647,7 +646,7 @@ static void handle_get_version_reply(struct ceph_mon_client *monc, | |||
| 647 | 646 | ||
| 648 | return; | 647 | return; |
| 649 | bad: | 648 | bad: |
| 650 | pr_err("corrupt mon_get_version reply\n"); | 649 | pr_err("corrupt mon_get_version reply, tid %llu\n", tid); |
| 651 | ceph_msg_dump(msg); | 650 | ceph_msg_dump(msg); |
| 652 | } | 651 | } |
| 653 | 652 | ||
| @@ -670,7 +669,6 @@ int ceph_monc_do_get_version(struct ceph_mon_client *monc, const char *what, | |||
| 670 | 669 | ||
| 671 | kref_init(&req->kref); | 670 | kref_init(&req->kref); |
| 672 | req->buf = newest; | 671 | req->buf = newest; |
| 673 | req->buf_len = sizeof(*newest); | ||
| 674 | init_completion(&req->completion); | 672 | init_completion(&req->completion); |
| 675 | 673 | ||
| 676 | req->request = ceph_msg_new(CEPH_MSG_MON_GET_VERSION, | 674 | req->request = ceph_msg_new(CEPH_MSG_MON_GET_VERSION, |
| @@ -701,134 +699,12 @@ int ceph_monc_do_get_version(struct ceph_mon_client *monc, const char *what, | |||
| 701 | 699 | ||
| 702 | mutex_unlock(&monc->mutex); | 700 | mutex_unlock(&monc->mutex); |
| 703 | out: | 701 | out: |
| 704 | kref_put(&req->kref, release_generic_request); | 702 | put_generic_request(req); |
| 705 | return err; | 703 | return err; |
| 706 | } | 704 | } |
| 707 | EXPORT_SYMBOL(ceph_monc_do_get_version); | 705 | EXPORT_SYMBOL(ceph_monc_do_get_version); |
| 708 | 706 | ||
| 709 | /* | 707 | /* |
| 710 | * pool ops | ||
| 711 | */ | ||
| 712 | static int get_poolop_reply_buf(const char *src, size_t src_len, | ||
| 713 | char *dst, size_t dst_len) | ||
| 714 | { | ||
| 715 | u32 buf_len; | ||
| 716 | |||
| 717 | if (src_len != sizeof(u32) + dst_len) | ||
| 718 | return -EINVAL; | ||
| 719 | |||
| 720 | buf_len = le32_to_cpu(*(__le32 *)src); | ||
| 721 | if (buf_len != dst_len) | ||
| 722 | return -EINVAL; | ||
| 723 | |||
| 724 | memcpy(dst, src + sizeof(u32), dst_len); | ||
| 725 | return 0; | ||
| 726 | } | ||
| 727 | |||
| 728 | static void handle_poolop_reply(struct ceph_mon_client *monc, | ||
| 729 | struct ceph_msg *msg) | ||
| 730 | { | ||
| 731 | struct ceph_mon_generic_request *req; | ||
| 732 | struct ceph_mon_poolop_reply *reply = msg->front.iov_base; | ||
| 733 | u64 tid = le64_to_cpu(msg->hdr.tid); | ||
| 734 | |||
| 735 | if (msg->front.iov_len < sizeof(*reply)) | ||
| 736 | goto bad; | ||
| 737 | dout("handle_poolop_reply %p tid %llu\n", msg, tid); | ||
| 738 | |||
| 739 | mutex_lock(&monc->mutex); | ||
| 740 | req = __lookup_generic_req(monc, tid); | ||
| 741 | if (req) { | ||
| 742 | if (req->buf_len && | ||
| 743 | get_poolop_reply_buf(msg->front.iov_base + sizeof(*reply), | ||
| 744 | msg->front.iov_len - sizeof(*reply), | ||
| 745 | req->buf, req->buf_len) < 0) { | ||
| 746 | mutex_unlock(&monc->mutex); | ||
| 747 | goto bad; | ||
| 748 | } | ||
| 749 | req->result = le32_to_cpu(reply->reply_code); | ||
| 750 | get_generic_request(req); | ||
| 751 | } | ||
| 752 | mutex_unlock(&monc->mutex); | ||
| 753 | if (req) { | ||
| 754 | complete(&req->completion); | ||
| 755 | put_generic_request(req); | ||
| 756 | } | ||
| 757 | return; | ||
| 758 | |||
| 759 | bad: | ||
| 760 | pr_err("corrupt generic reply, tid %llu\n", tid); | ||
| 761 | ceph_msg_dump(msg); | ||
| 762 | } | ||
| 763 | |||
| 764 | /* | ||
| 765 | * Do a synchronous pool op. | ||
| 766 | */ | ||
| 767 | static int do_poolop(struct ceph_mon_client *monc, u32 op, | ||
| 768 | u32 pool, u64 snapid, | ||
| 769 | char *buf, int len) | ||
| 770 | { | ||
| 771 | struct ceph_mon_generic_request *req; | ||
| 772 | struct ceph_mon_poolop *h; | ||
| 773 | int err; | ||
| 774 | |||
| 775 | req = kzalloc(sizeof(*req), GFP_NOFS); | ||
| 776 | if (!req) | ||
| 777 | return -ENOMEM; | ||
| 778 | |||
| 779 | kref_init(&req->kref); | ||
| 780 | req->buf = buf; | ||
| 781 | req->buf_len = len; | ||
| 782 | init_completion(&req->completion); | ||
| 783 | |||
| 784 | err = -ENOMEM; | ||
| 785 | req->request = ceph_msg_new(CEPH_MSG_POOLOP, sizeof(*h), GFP_NOFS, | ||
| 786 | true); | ||
| 787 | if (!req->request) | ||
| 788 | goto out; | ||
| 789 | req->reply = ceph_msg_new(CEPH_MSG_POOLOP_REPLY, 1024, GFP_NOFS, | ||
| 790 | true); | ||
| 791 | if (!req->reply) | ||
| 792 | goto out; | ||
| 793 | |||
| 794 | /* fill out request */ | ||
| 795 | req->request->hdr.version = cpu_to_le16(2); | ||
| 796 | h = req->request->front.iov_base; | ||
| 797 | h->monhdr.have_version = 0; | ||
| 798 | h->monhdr.session_mon = cpu_to_le16(-1); | ||
| 799 | h->monhdr.session_mon_tid = 0; | ||
| 800 | h->fsid = monc->monmap->fsid; | ||
| 801 | h->pool = cpu_to_le32(pool); | ||
| 802 | h->op = cpu_to_le32(op); | ||
| 803 | h->auid = 0; | ||
| 804 | h->snapid = cpu_to_le64(snapid); | ||
| 805 | h->name_len = 0; | ||
| 806 | |||
| 807 | err = do_generic_request(monc, req); | ||
| 808 | |||
| 809 | out: | ||
| 810 | kref_put(&req->kref, release_generic_request); | ||
| 811 | return err; | ||
| 812 | } | ||
| 813 | |||
| 814 | int ceph_monc_create_snapid(struct ceph_mon_client *monc, | ||
| 815 | u32 pool, u64 *snapid) | ||
| 816 | { | ||
| 817 | return do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP, | ||
| 818 | pool, 0, (char *)snapid, sizeof(*snapid)); | ||
| 819 | |||
| 820 | } | ||
| 821 | EXPORT_SYMBOL(ceph_monc_create_snapid); | ||
| 822 | |||
| 823 | int ceph_monc_delete_snapid(struct ceph_mon_client *monc, | ||
| 824 | u32 pool, u64 snapid) | ||
| 825 | { | ||
| 826 | return do_poolop(monc, POOL_OP_CREATE_UNMANAGED_SNAP, | ||
| 827 | pool, snapid, NULL, 0); | ||
| 828 | |||
| 829 | } | ||
| 830 | |||
| 831 | /* | ||
| 832 | * Resend pending generic requests. | 708 | * Resend pending generic requests. |
| 833 | */ | 709 | */ |
| 834 | static void __resend_generic_request(struct ceph_mon_client *monc) | 710 | static void __resend_generic_request(struct ceph_mon_client *monc) |
| @@ -1112,10 +988,6 @@ static void dispatch(struct ceph_connection *con, struct ceph_msg *msg) | |||
| 1112 | handle_get_version_reply(monc, msg); | 988 | handle_get_version_reply(monc, msg); |
| 1113 | break; | 989 | break; |
| 1114 | 990 | ||
| 1115 | case CEPH_MSG_POOLOP_REPLY: | ||
| 1116 | handle_poolop_reply(monc, msg); | ||
| 1117 | break; | ||
| 1118 | |||
| 1119 | case CEPH_MSG_MON_MAP: | 991 | case CEPH_MSG_MON_MAP: |
| 1120 | ceph_monc_handle_map(monc, msg); | 992 | ceph_monc_handle_map(monc, msg); |
| 1121 | break; | 993 | break; |
| @@ -1154,7 +1026,6 @@ static struct ceph_msg *mon_alloc_msg(struct ceph_connection *con, | |||
| 1154 | case CEPH_MSG_MON_SUBSCRIBE_ACK: | 1026 | case CEPH_MSG_MON_SUBSCRIBE_ACK: |
| 1155 | m = ceph_msg_get(monc->m_subscribe_ack); | 1027 | m = ceph_msg_get(monc->m_subscribe_ack); |
| 1156 | break; | 1028 | break; |
| 1157 | case CEPH_MSG_POOLOP_REPLY: | ||
| 1158 | case CEPH_MSG_STATFS_REPLY: | 1029 | case CEPH_MSG_STATFS_REPLY: |
| 1159 | return get_generic_reply(con, hdr, skip); | 1030 | return get_generic_reply(con, hdr, skip); |
| 1160 | case CEPH_MSG_AUTH_REPLY: | 1031 | case CEPH_MSG_AUTH_REPLY: |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 53299c7b0ca4..41a4abc7e98e 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
| @@ -1035,10 +1035,11 @@ static void put_osd(struct ceph_osd *osd) | |||
| 1035 | { | 1035 | { |
| 1036 | dout("put_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref), | 1036 | dout("put_osd %p %d -> %d\n", osd, atomic_read(&osd->o_ref), |
| 1037 | atomic_read(&osd->o_ref) - 1); | 1037 | atomic_read(&osd->o_ref) - 1); |
| 1038 | if (atomic_dec_and_test(&osd->o_ref) && osd->o_auth.authorizer) { | 1038 | if (atomic_dec_and_test(&osd->o_ref)) { |
| 1039 | struct ceph_auth_client *ac = osd->o_osdc->client->monc.auth; | 1039 | struct ceph_auth_client *ac = osd->o_osdc->client->monc.auth; |
| 1040 | 1040 | ||
| 1041 | ceph_auth_destroy_authorizer(ac, osd->o_auth.authorizer); | 1041 | if (osd->o_auth.authorizer) |
| 1042 | ceph_auth_destroy_authorizer(ac, osd->o_auth.authorizer); | ||
| 1042 | kfree(osd); | 1043 | kfree(osd); |
| 1043 | } | 1044 | } |
| 1044 | } | 1045 | } |
| @@ -1048,14 +1049,24 @@ static void put_osd(struct ceph_osd *osd) | |||
| 1048 | */ | 1049 | */ |
| 1049 | static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) | 1050 | static void __remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) |
| 1050 | { | 1051 | { |
| 1051 | dout("__remove_osd %p\n", osd); | 1052 | dout("%s %p osd%d\n", __func__, osd, osd->o_osd); |
| 1052 | WARN_ON(!list_empty(&osd->o_requests)); | 1053 | WARN_ON(!list_empty(&osd->o_requests)); |
| 1053 | WARN_ON(!list_empty(&osd->o_linger_requests)); | 1054 | WARN_ON(!list_empty(&osd->o_linger_requests)); |
| 1054 | 1055 | ||
| 1055 | rb_erase(&osd->o_node, &osdc->osds); | ||
| 1056 | list_del_init(&osd->o_osd_lru); | 1056 | list_del_init(&osd->o_osd_lru); |
| 1057 | ceph_con_close(&osd->o_con); | 1057 | rb_erase(&osd->o_node, &osdc->osds); |
| 1058 | put_osd(osd); | 1058 | RB_CLEAR_NODE(&osd->o_node); |
| 1059 | } | ||
| 1060 | |||
| 1061 | static void remove_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) | ||
| 1062 | { | ||
| 1063 | dout("%s %p osd%d\n", __func__, osd, osd->o_osd); | ||
| 1064 | |||
| 1065 | if (!RB_EMPTY_NODE(&osd->o_node)) { | ||
| 1066 | ceph_con_close(&osd->o_con); | ||
| 1067 | __remove_osd(osdc, osd); | ||
| 1068 | put_osd(osd); | ||
| 1069 | } | ||
| 1059 | } | 1070 | } |
| 1060 | 1071 | ||
| 1061 | static void remove_all_osds(struct ceph_osd_client *osdc) | 1072 | static void remove_all_osds(struct ceph_osd_client *osdc) |
| @@ -1065,7 +1076,7 @@ static void remove_all_osds(struct ceph_osd_client *osdc) | |||
| 1065 | while (!RB_EMPTY_ROOT(&osdc->osds)) { | 1076 | while (!RB_EMPTY_ROOT(&osdc->osds)) { |
| 1066 | struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds), | 1077 | struct ceph_osd *osd = rb_entry(rb_first(&osdc->osds), |
| 1067 | struct ceph_osd, o_node); | 1078 | struct ceph_osd, o_node); |
| 1068 | __remove_osd(osdc, osd); | 1079 | remove_osd(osdc, osd); |
| 1069 | } | 1080 | } |
| 1070 | mutex_unlock(&osdc->request_mutex); | 1081 | mutex_unlock(&osdc->request_mutex); |
| 1071 | } | 1082 | } |
| @@ -1106,7 +1117,7 @@ static void remove_old_osds(struct ceph_osd_client *osdc) | |||
| 1106 | list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) { | 1117 | list_for_each_entry_safe(osd, nosd, &osdc->osd_lru, o_osd_lru) { |
| 1107 | if (time_before(jiffies, osd->lru_ttl)) | 1118 | if (time_before(jiffies, osd->lru_ttl)) |
| 1108 | break; | 1119 | break; |
| 1109 | __remove_osd(osdc, osd); | 1120 | remove_osd(osdc, osd); |
| 1110 | } | 1121 | } |
| 1111 | mutex_unlock(&osdc->request_mutex); | 1122 | mutex_unlock(&osdc->request_mutex); |
| 1112 | } | 1123 | } |
| @@ -1121,8 +1132,7 @@ static int __reset_osd(struct ceph_osd_client *osdc, struct ceph_osd *osd) | |||
| 1121 | dout("__reset_osd %p osd%d\n", osd, osd->o_osd); | 1132 | dout("__reset_osd %p osd%d\n", osd, osd->o_osd); |
| 1122 | if (list_empty(&osd->o_requests) && | 1133 | if (list_empty(&osd->o_requests) && |
| 1123 | list_empty(&osd->o_linger_requests)) { | 1134 | list_empty(&osd->o_linger_requests)) { |
| 1124 | __remove_osd(osdc, osd); | 1135 | remove_osd(osdc, osd); |
| 1125 | |||
| 1126 | return -ENODEV; | 1136 | return -ENODEV; |
| 1127 | } | 1137 | } |
| 1128 | 1138 | ||
| @@ -1926,6 +1936,7 @@ static void reset_changed_osds(struct ceph_osd_client *osdc) | |||
| 1926 | { | 1936 | { |
| 1927 | struct rb_node *p, *n; | 1937 | struct rb_node *p, *n; |
| 1928 | 1938 | ||
| 1939 | dout("%s %p\n", __func__, osdc); | ||
| 1929 | for (p = rb_first(&osdc->osds); p; p = n) { | 1940 | for (p = rb_first(&osdc->osds); p; p = n) { |
| 1930 | struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node); | 1941 | struct ceph_osd *osd = rb_entry(p, struct ceph_osd, o_node); |
| 1931 | 1942 | ||
