libceph: no more kick_requests() race
[deliverable/linux.git] / net / ceph / osd_client.c
index f9276cb26aa2b4dad552ddc1222f79f60c9ee1c3..3723a7f16afd26f71ecf23c661e639cdc73b92fe 100644 (file)
@@ -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);
This page took 0.04172 seconds and 5 git commands to generate.