aboutsummaryrefslogtreecommitdiffstats
path: root/net/ceph/osd_client.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r--net/ceph/osd_client.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 02212ed50852..5a80f41c0cba 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -579,9 +579,15 @@ static void __kick_osd_requests(struct ceph_osd_client *osdc,
579 579
580 list_for_each_entry_safe(req, nreq, &osd->o_linger_requests, 580 list_for_each_entry_safe(req, nreq, &osd->o_linger_requests,
581 r_linger_osd) { 581 r_linger_osd) {
582 __unregister_linger_request(osdc, req); 582 /*
583 * reregister request prior to unregistering linger so
584 * that r_osd is preserved.
585 */
586 BUG_ON(!list_empty(&req->r_req_lru_item));
583 __register_request(osdc, req); 587 __register_request(osdc, req);
584 list_move(&req->r_req_lru_item, &osdc->req_unsent); 588 list_add(&req->r_req_lru_item, &osdc->req_unsent);
589 list_add(&req->r_osd_item, &req->r_osd->o_requests);
590 __unregister_linger_request(osdc, req);
585 dout("requeued lingering %p tid %llu osd%d\n", req, req->r_tid, 591 dout("requeued lingering %p tid %llu osd%d\n", req, req->r_tid,
586 osd->o_osd); 592 osd->o_osd);
587 } 593 }
@@ -798,7 +804,7 @@ static void __register_request(struct ceph_osd_client *osdc,
798 req->r_request->hdr.tid = cpu_to_le64(req->r_tid); 804 req->r_request->hdr.tid = cpu_to_le64(req->r_tid);
799 INIT_LIST_HEAD(&req->r_req_lru_item); 805 INIT_LIST_HEAD(&req->r_req_lru_item);
800 806
801 dout("register_request %p tid %lld\n", req, req->r_tid); 807 dout("__register_request %p tid %lld\n", req, req->r_tid);
802 __insert_request(osdc, req); 808 __insert_request(osdc, req);
803 ceph_osdc_get_request(req); 809 ceph_osdc_get_request(req);
804 osdc->num_requests++; 810 osdc->num_requests++;
@@ -837,8 +843,7 @@ static void __unregister_request(struct ceph_osd_client *osdc,
837 dout("moving osd to %p lru\n", req->r_osd); 843 dout("moving osd to %p lru\n", req->r_osd);
838 __move_osd_to_lru(osdc, req->r_osd); 844 __move_osd_to_lru(osdc, req->r_osd);
839 } 845 }
840 if (list_empty(&req->r_osd_item) && 846 if (list_empty(&req->r_linger_item))
841 list_empty(&req->r_linger_item))
842 req->r_osd = NULL; 847 req->r_osd = NULL;
843 } 848 }
844 849
@@ -883,7 +888,8 @@ static void __unregister_linger_request(struct ceph_osd_client *osdc,
883 dout("moving osd to %p lru\n", req->r_osd); 888 dout("moving osd to %p lru\n", req->r_osd);
884 __move_osd_to_lru(osdc, req->r_osd); 889 __move_osd_to_lru(osdc, req->r_osd);
885 } 890 }
886 req->r_osd = NULL; 891 if (list_empty(&req->r_osd_item))
892 req->r_osd = NULL;
887 } 893 }
888} 894}
889 895
@@ -917,7 +923,7 @@ EXPORT_SYMBOL(ceph_osdc_set_request_linger);
917/* 923/*
918 * Pick an osd (the first 'up' osd in the pg), allocate the osd struct 924 * Pick an osd (the first 'up' osd in the pg), allocate the osd struct
919 * (as needed), and set the request r_osd appropriately. If there is 925 * (as needed), and set the request r_osd appropriately. If there is
920 * no up osd, set r_osd to NULL. Move the request to the appropiate list 926 * no up osd, set r_osd to NULL. Move the request to the appropriate list
921 * (unsent, homeless) or leave on in-flight lru. 927 * (unsent, homeless) or leave on in-flight lru.
922 * 928 *
923 * Return 0 if unchanged, 1 if changed, or negative on error. 929 * Return 0 if unchanged, 1 if changed, or negative on error.
@@ -1602,11 +1608,11 @@ void handle_watch_notify(struct ceph_osd_client *osdc, struct ceph_msg *msg)
1602 cookie, ver, event); 1608 cookie, ver, event);
1603 if (event) { 1609 if (event) {
1604 event_work = kmalloc(sizeof(*event_work), GFP_NOIO); 1610 event_work = kmalloc(sizeof(*event_work), GFP_NOIO);
1605 INIT_WORK(&event_work->work, do_event_work);
1606 if (!event_work) { 1611 if (!event_work) {
1607 dout("ERROR: could not allocate event_work\n"); 1612 dout("ERROR: could not allocate event_work\n");
1608 goto done_err; 1613 goto done_err;
1609 } 1614 }
1615 INIT_WORK(&event_work->work, do_event_work);
1610 event_work->event = event; 1616 event_work->event = event;
1611 event_work->ver = ver; 1617 event_work->ver = ver;
1612 event_work->notify_id = notify_id; 1618 event_work->notify_id = notify_id;
@@ -1672,7 +1678,7 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1672 if (req->r_sent == 0) { 1678 if (req->r_sent == 0) {
1673 rc = __map_request(osdc, req); 1679 rc = __map_request(osdc, req);
1674 if (rc < 0) 1680 if (rc < 0)
1675 return rc; 1681 goto out_unlock;
1676 if (req->r_osd == NULL) { 1682 if (req->r_osd == NULL) {
1677 dout("send_request %p no up osds in pg\n", req); 1683 dout("send_request %p no up osds in pg\n", req);
1678 ceph_monc_request_next_osdmap(&osdc->client->monc); 1684 ceph_monc_request_next_osdmap(&osdc->client->monc);
@@ -1689,6 +1695,8 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
1689 } 1695 }
1690 } 1696 }
1691 } 1697 }
1698
1699out_unlock:
1692 mutex_unlock(&osdc->request_mutex); 1700 mutex_unlock(&osdc->request_mutex);
1693 up_read(&osdc->map_sem); 1701 up_read(&osdc->map_sem);
1694 return rc; 1702 return rc;