aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--net/ceph/osd_client.c62
1 files changed, 39 insertions, 23 deletions
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
index 166d4c7ba065..2aa82b6bb305 100644
--- a/net/ceph/osd_client.c
+++ b/net/ceph/osd_client.c
@@ -1427,6 +1427,40 @@ static void __send_queued(struct ceph_osd_client *osdc)
1427} 1427}
1428 1428
1429/* 1429/*
1430 * Caller should hold map_sem for read and request_mutex.
1431 */
1432static int __ceph_osdc_start_request(struct ceph_osd_client *osdc,
1433 struct ceph_osd_request *req,
1434 bool nofail)
1435{
1436 int rc;
1437
1438 __register_request(osdc, req);
1439 req->r_sent = 0;
1440 req->r_got_reply = 0;
1441 rc = __map_request(osdc, req, 0);
1442 if (rc < 0) {
1443 if (nofail) {
1444 dout("osdc_start_request failed map, "
1445 " will retry %lld\n", req->r_tid);
1446 rc = 0;
1447 } else {
1448 __unregister_request(osdc, req);
1449 }
1450 return rc;
1451 }
1452
1453 if (req->r_osd == NULL) {
1454 dout("send_request %p no up osds in pg\n", req);
1455 ceph_monc_request_next_osdmap(&osdc->client->monc);
1456 } else {
1457 __send_queued(osdc);
1458 }
1459
1460 return 0;
1461}
1462
1463/*
1430 * Timeout callback, called every N seconds when 1 or more osd 1464 * Timeout callback, called every N seconds when 1 or more osd
1431 * requests has been active for more than N seconds. When this 1465 * requests has been active for more than N seconds. When this
1432 * happens, we ping all OSDs with requests who have timed out to 1466 * happens, we ping all OSDs with requests who have timed out to
@@ -2351,34 +2385,16 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc,
2351 struct ceph_osd_request *req, 2385 struct ceph_osd_request *req,
2352 bool nofail) 2386 bool nofail)
2353{ 2387{
2354 int rc = 0; 2388 int rc;
2355 2389
2356 down_read(&osdc->map_sem); 2390 down_read(&osdc->map_sem);
2357 mutex_lock(&osdc->request_mutex); 2391 mutex_lock(&osdc->request_mutex);
2358 __register_request(osdc, req); 2392
2359 req->r_sent = 0; 2393 rc = __ceph_osdc_start_request(osdc, req, nofail);
2360 req->r_got_reply = 0; 2394
2361 rc = __map_request(osdc, req, 0);
2362 if (rc < 0) {
2363 if (nofail) {
2364 dout("osdc_start_request failed map, "
2365 " will retry %lld\n", req->r_tid);
2366 rc = 0;
2367 } else {
2368 __unregister_request(osdc, req);
2369 }
2370 goto out_unlock;
2371 }
2372 if (req->r_osd == NULL) {
2373 dout("send_request %p no up osds in pg\n", req);
2374 ceph_monc_request_next_osdmap(&osdc->client->monc);
2375 } else {
2376 __send_queued(osdc);
2377 }
2378 rc = 0;
2379out_unlock:
2380 mutex_unlock(&osdc->request_mutex); 2395 mutex_unlock(&osdc->request_mutex);
2381 up_read(&osdc->map_sem); 2396 up_read(&osdc->map_sem);
2397
2382 return rc; 2398 return rc;
2383} 2399}
2384EXPORT_SYMBOL(ceph_osdc_start_request); 2400EXPORT_SYMBOL(ceph_osdc_start_request);