If we retry a request from io_op_done we currenly opencode the sequence in
requeue_request, except that the call to check_reques is missing.  Given
that the epoch may change the call to check_request is nesscary and we
should call requeue_request in io_op_done as well.

To get requeue_request in scope provide a forward declaration for it at the
the top of file and move the implementation below queue_request.

Signed-off-by: Christoph Hellwig <hch@lst.de>

diff --git a/sheep/sdnet.c b/sheep/sdnet.c
index 5f43b25..433e0fd 100644
--- a/sheep/sdnet.c
+++ b/sheep/sdnet.c
@@ -20,7 +20,7 @@
 
 #include "sheep_priv.h"
 
-static void queue_request(struct request *req);
+static void requeue_request(struct request *req);
 
 static int is_access_local(struct request *req, uint64_t oid)
 {
@@ -190,12 +190,7 @@ static void io_op_done(struct work *work)
 	return;
 
 retry:
-	req->rq.epoch = sys->epoch;
-
-	put_vnode_info(req->vnodes);
-	req->vnodes = get_vnode_info();
-	setup_access_to_local_objects(req);
-	process_io_request(req);
+	requeue_request(req);
 }
 
 static void local_op_done(struct work *work)
@@ -281,14 +276,6 @@ static int check_request(struct request *req)
 	return 0;
 }
 
-static void requeue_request(struct request *req)
-{
-	list_del(&req->request_list);
-	if (req->vnodes)
-		put_vnode_info(req->vnodes);
-	queue_request(req);
-}
-
 void resume_pending_requests(void)
 {
 	struct request *req, *n;
@@ -471,6 +458,14 @@ done:
 	req_done(req);
 }
 
+static void requeue_request(struct request *req)
+{
+	list_del(&req->request_list);
+	if (req->vnodes)
+		put_vnode_info(req->vnodes);
+	queue_request(req);
+}
+
 static void client_incref(struct client_info *ci);
 static void client_decref(struct client_info *ci);
 


