From: Alex Elder <elder@inktank.com>
To: ceph-devel@vger.kernel.org
Subject: [PATCH 2/6] libceph: no more kick_requests() race
Date: Mon, 25 Mar 2013 21:27:27 -0500 [thread overview]
Message-ID: <5151078F.5000509@inktank.com> (raw)
In-Reply-To: <5151071C.3000309@inktank.com>
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>
---
net/ceph/osd_client.c | 37 +++++++++++++++----------------------
1 file changed, 15 insertions(+), 22 deletions(-)
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index f9276cb..3723a7f 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,
down_read(&osdc->map_sem);
mutex_lock(&osdc->request_mutex);
- /*
- * a racing kick_requests() may have sent the message for us
- * while we dropped request_mutex above, so only send now if
- * the request still han't been touched yet.
- */
__register_request(osdc, req);
- if (req->r_sent == 0) {
- rc = __map_request(osdc, req, 0);
- if (rc < 0) {
- if (nofail) {
- dout("osdc_start_request failed map, "
- " will retry %lld\n", req->r_tid);
- rc = 0;
- }
- goto out_unlock;
- }
- if (req->r_osd == NULL) {
- dout("send_request %p no up osds in pg\n", req);
- ceph_monc_request_next_osdmap(&osdc->client->monc);
- } else {
- __send_request(osdc, req);
+ WARN_ON(req->r_sent);
+ rc = __map_request(osdc, req, 0);
+ if (rc < 0) {
+ if (nofail) {
+ dout("osdc_start_request failed map, "
+ " will retry %lld\n", req->r_tid);
+ rc = 0;
}
- rc = 0;
+ goto out_unlock;
}
-
+ if (req->r_osd == NULL) {
+ dout("send_request %p no up osds in pg\n", req);
+ ceph_monc_request_next_osdmap(&osdc->client->monc);
+ } else {
+ __send_request(osdc, req);
+ }
+ rc = 0;
out_unlock:
mutex_unlock(&osdc->request_mutex);
up_read(&osdc->map_sem);
--
1.7.9.5
next prev parent reply other threads:[~2013-03-26 2:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-26 2:25 [PATCH 0/6] libceph: send osd requests in tid order Alex Elder
2013-03-26 2:27 ` [PATCH 1/6] libceph: slightly defer registering osd request Alex Elder
2013-03-26 2:27 ` Alex Elder [this message]
2013-03-26 2:27 ` [PATCH 3/6] libceph: prepend requests in order when kicking Alex Elder
2013-03-26 14:50 ` [PATCH 3/6, v2] libceph: requeue only sent requests " Alex Elder
2013-03-26 2:27 ` [PATCH 4/6] libceph: keep request lists in tid order Alex Elder
2013-03-26 2:28 ` [PATCH 5/6] libceph: send queued requests when starting new one Alex Elder
2013-03-26 2:28 ` [PATCH 6/6] libceph: verify requests queued in order Alex Elder
2013-03-26 14:50 ` [PATCH 6/6, v2] " Alex Elder
2013-03-26 14:49 ` [PATCH 0/6] libceph: send osd requests in tid order Alex Elder
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5151078F.5000509@inktank.com \
--to=elder@inktank.com \
--cc=ceph-devel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.