diff options
author | Alex Elder <elder@inktank.com> | 2013-03-25 19:16:11 -0400 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2013-05-02 00:17:17 -0400 |
commit | 92451b4910895936cc05ce1d283644ffc44d7537 (patch) | |
tree | 6ebb20c2379f2c3384ec665fb574cb3919bc3a9c /net/ceph/osd_client.c | |
parent | dc4b870c97a5006871c259f7e61ea6c79038f731 (diff) |
libceph: no more kick_requests() race
Since we no longer drop the request mutex between registering and
mapping an osd request in ceph_osdc_start_request(), there is no
chance of a race with kick_requests().
We can now therefore map and send the new request unconditionally
(but we'll issue a warning should it ever occur).
Signed-off-by: Alex Elder <elder@inktank.com>
Reviewed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'net/ceph/osd_client.c')
-rw-r--r-- | net/ceph/osd_client.c | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index f9276cb26aa2..3723a7f16afd 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1779,31 +1779,24 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, | |||
1779 | 1779 | ||
1780 | down_read(&osdc->map_sem); | 1780 | down_read(&osdc->map_sem); |
1781 | mutex_lock(&osdc->request_mutex); | 1781 | mutex_lock(&osdc->request_mutex); |
1782 | /* | ||
1783 | * a racing kick_requests() may have sent the message for us | ||
1784 | * while we dropped request_mutex above, so only send now if | ||
1785 | * the request still han't been touched yet. | ||
1786 | */ | ||
1787 | __register_request(osdc, req); | 1782 | __register_request(osdc, req); |
1788 | if (req->r_sent == 0) { | 1783 | WARN_ON(req->r_sent); |
1789 | rc = __map_request(osdc, req, 0); | 1784 | rc = __map_request(osdc, req, 0); |
1790 | if (rc < 0) { | 1785 | if (rc < 0) { |
1791 | if (nofail) { | 1786 | if (nofail) { |
1792 | dout("osdc_start_request failed map, " | 1787 | dout("osdc_start_request failed map, " |
1793 | " will retry %lld\n", req->r_tid); | 1788 | " will retry %lld\n", req->r_tid); |
1794 | rc = 0; | 1789 | rc = 0; |
1795 | } | ||
1796 | goto out_unlock; | ||
1797 | } | ||
1798 | if (req->r_osd == NULL) { | ||
1799 | dout("send_request %p no up osds in pg\n", req); | ||
1800 | ceph_monc_request_next_osdmap(&osdc->client->monc); | ||
1801 | } else { | ||
1802 | __send_request(osdc, req); | ||
1803 | } | 1790 | } |
1804 | rc = 0; | 1791 | goto out_unlock; |
1805 | } | 1792 | } |
1806 | 1793 | if (req->r_osd == NULL) { | |
1794 | dout("send_request %p no up osds in pg\n", req); | ||
1795 | ceph_monc_request_next_osdmap(&osdc->client->monc); | ||
1796 | } else { | ||
1797 | __send_request(osdc, req); | ||
1798 | } | ||
1799 | rc = 0; | ||
1807 | out_unlock: | 1800 | out_unlock: |
1808 | mutex_unlock(&osdc->request_mutex); | 1801 | mutex_unlock(&osdc->request_mutex); |
1809 | up_read(&osdc->map_sem); | 1802 | up_read(&osdc->map_sem); |