From: levin li <xingke.lwp at taobao.com> When a new recovery work replaces the old one, we should clear the waiting requests in the wait_obj_queue to make them retry for the new work, or else, the requests in the queue may never be waked up. Signed-off-by: levin li <xingke.lwp at taobao.com> --- sheep/recovery.c | 15 ++++++++++++++- sheep/sdnet.c | 2 +- sheep/sheep_priv.h | 2 +- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sheep/recovery.c b/sheep/recovery.c index 179937b..2c16cf4 100644 --- a/sheep/recovery.c +++ b/sheep/recovery.c @@ -593,6 +593,17 @@ static void resume_wait_recovery_queue(void) } } +static void clear_wait_obj_requests(void) +{ + struct request *req, *t; + + list_for_each_entry_safe(req, t, &sys->wait_obj_queue, request_list) { + list_del(&req->request_list); + list_add_tail(&req->request_list, &sys->request_queue); + process_request_event_queues(); + } +} + static void do_recover_main(struct work *work) { struct recovery_work *rw = container_of(work, struct recovery_work, work); @@ -628,7 +639,7 @@ again: rw->oid_to_recovery = oid; if (recovered_oid) - resume_retry_requests(recovered_oid); + resume_wait_obj_requests(recovered_oid); if (rw->retry && !next_rw) { rw->retry = 0; @@ -668,6 +679,8 @@ again: rw = next_rw; next_rw = NULL; + clear_wait_obj_requests(); + recovering_work = rw; queue_work(sys->recovery_wqueue, &rw->work); } else { diff --git a/sheep/sdnet.c b/sheep/sdnet.c index b0724be..e512fdc 100644 --- a/sheep/sdnet.c +++ b/sheep/sdnet.c @@ -290,7 +290,7 @@ void resume_wait_epoch_requests(void) } } -void resume_retry_requests(uint64_t oid) +void resume_wait_obj_requests(uint64_t oid) { struct request *req, *t; diff --git a/sheep/sheep_priv.h b/sheep/sheep_priv.h index 8a5a2dc..80dc0c1 100644 --- a/sheep/sheep_priv.h +++ b/sheep/sheep_priv.h @@ -267,7 +267,7 @@ int is_access_to_busy_objects(uint64_t oid); void resume_pending_requests(void); void resume_wait_epoch_requests(void); -void resume_retry_requests(uint64_t oid); +void resume_wait_obj_requests(uint64_t oid); int create_cluster(int port, int64_t zone, int nr_vnodes); int leave_cluster(void); -- 1.7.10 |