diff options
-rw-r--r-- | include/linux/ceph/osd_client.h | 1 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 31 |
2 files changed, 26 insertions, 6 deletions
diff --git a/include/linux/ceph/osd_client.h b/include/linux/ceph/osd_client.h index a8d5652f589d..de09cad7b7c7 100644 --- a/include/linux/ceph/osd_client.h +++ b/include/linux/ceph/osd_client.h | |||
@@ -334,6 +334,7 @@ extern void ceph_osdc_put_request(struct ceph_osd_request *req); | |||
334 | extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, | 334 | extern int ceph_osdc_start_request(struct ceph_osd_client *osdc, |
335 | struct ceph_osd_request *req, | 335 | struct ceph_osd_request *req, |
336 | bool nofail); | 336 | bool nofail); |
337 | extern void ceph_osdc_cancel_request(struct ceph_osd_request *req); | ||
337 | extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc, | 338 | extern int ceph_osdc_wait_request(struct ceph_osd_client *osdc, |
338 | struct ceph_osd_request *req); | 339 | struct ceph_osd_request *req); |
339 | extern void ceph_osdc_sync(struct ceph_osd_client *osdc); | 340 | extern void ceph_osdc_sync(struct ceph_osd_client *osdc); |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index 89d7d8861d80..6c1ccf5590a3 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -2468,6 +2468,25 @@ int ceph_osdc_start_request(struct ceph_osd_client *osdc, | |||
2468 | EXPORT_SYMBOL(ceph_osdc_start_request); | 2468 | EXPORT_SYMBOL(ceph_osdc_start_request); |
2469 | 2469 | ||
2470 | /* | 2470 | /* |
2471 | * Unregister a registered request. The request is not completed (i.e. | ||
2472 | * no callbacks or wakeups) - higher layers are supposed to know what | ||
2473 | * they are canceling. | ||
2474 | */ | ||
2475 | void ceph_osdc_cancel_request(struct ceph_osd_request *req) | ||
2476 | { | ||
2477 | struct ceph_osd_client *osdc = req->r_osdc; | ||
2478 | |||
2479 | mutex_lock(&osdc->request_mutex); | ||
2480 | if (req->r_linger) | ||
2481 | __unregister_linger_request(osdc, req); | ||
2482 | __unregister_request(osdc, req); | ||
2483 | mutex_unlock(&osdc->request_mutex); | ||
2484 | |||
2485 | dout("%s %p tid %llu canceled\n", __func__, req, req->r_tid); | ||
2486 | } | ||
2487 | EXPORT_SYMBOL(ceph_osdc_cancel_request); | ||
2488 | |||
2489 | /* | ||
2471 | * wait for a request to complete | 2490 | * wait for a request to complete |
2472 | */ | 2491 | */ |
2473 | int ceph_osdc_wait_request(struct ceph_osd_client *osdc, | 2492 | int ceph_osdc_wait_request(struct ceph_osd_client *osdc, |
@@ -2475,18 +2494,18 @@ int ceph_osdc_wait_request(struct ceph_osd_client *osdc, | |||
2475 | { | 2494 | { |
2476 | int rc; | 2495 | int rc; |
2477 | 2496 | ||
2497 | dout("%s %p tid %llu\n", __func__, req, req->r_tid); | ||
2498 | |||
2478 | rc = wait_for_completion_interruptible(&req->r_completion); | 2499 | rc = wait_for_completion_interruptible(&req->r_completion); |
2479 | if (rc < 0) { | 2500 | if (rc < 0) { |
2480 | mutex_lock(&osdc->request_mutex); | 2501 | dout("%s %p tid %llu interrupted\n", __func__, req, req->r_tid); |
2481 | __cancel_request(req); | 2502 | ceph_osdc_cancel_request(req); |
2482 | __unregister_request(osdc, req); | ||
2483 | mutex_unlock(&osdc->request_mutex); | ||
2484 | complete_request(req); | 2503 | complete_request(req); |
2485 | dout("wait_request tid %llu canceled/timed out\n", req->r_tid); | ||
2486 | return rc; | 2504 | return rc; |
2487 | } | 2505 | } |
2488 | 2506 | ||
2489 | dout("wait_request tid %llu result %d\n", req->r_tid, req->r_result); | 2507 | dout("%s %p tid %llu result %d\n", __func__, req, req->r_tid, |
2508 | req->r_result); | ||
2490 | return req->r_result; | 2509 | return req->r_result; |
2491 | } | 2510 | } |
2492 | EXPORT_SYMBOL(ceph_osdc_wait_request); | 2511 | EXPORT_SYMBOL(ceph_osdc_wait_request); |