Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92451b49 authored by Alex Elder's avatar Alex Elder Committed by Sage Weil
Browse files

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: default avatarAlex Elder <elder@inktank.com>
Reviewed-off-by: default avatarSage Weil <sage@inktank.com>
parent dc4b870c
Loading
Loading
Loading
Loading
+15 −22
Original line number Diff line number Diff line
@@ -1779,13 +1779,8 @@ 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) {
	WARN_ON(req->r_sent);
	rc = __map_request(osdc, req, 0);
	if (rc < 0) {
		if (nofail) {
@@ -1802,8 +1797,6 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
		__send_request(osdc, req);
	}
	rc = 0;
	}

out_unlock:
	mutex_unlock(&osdc->request_mutex);
	up_read(&osdc->map_sem);