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 | 10 +++++++++- sheep/sdnet.c | 2 +- sheep/sheep_priv.h | 2 +- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/sheep/recovery.c b/sheep/recovery.c index 0708eeb..058e108 100644 --- a/sheep/recovery.c +++ b/sheep/recovery.c @@ -407,6 +407,12 @@ static void resume_wait_recovery_requests(void) process_request_event_queues(); } +static void flush_wait_obj_requests(void) +{ + list_splice_tail_init(&sys->wait_obj_queue, &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); @@ -425,7 +431,7 @@ static void do_recover_main(struct work *work) oid = rw->oids[rw->done]; if (recovered_oid) - resume_retry_requests(recovered_oid); + resume_wait_obj_requests(recovered_oid); if (rw->retry && !next_rw) { rw->retry = 0; @@ -460,6 +466,8 @@ static void do_recover_main(struct work *work) rw = next_rw; next_rw = NULL; + flush_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 fa205b4..d00dd45 100644 --- a/sheep/sdnet.c +++ b/sheep/sdnet.c @@ -280,7 +280,7 @@ void resume_wait_epoch_requests(void) process_request_event_queues(); } -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 67fbf1a..69ece1c 100644 --- a/sheep/sheep_priv.h +++ b/sheep/sheep_priv.h @@ -270,7 +270,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 |