aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/client.c12
-rw-r--r--drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c23
2 files changed, 20 insertions, 15 deletions
diff --git a/drivers/staging/lustre/lustre/ptlrpc/client.c b/drivers/staging/lustre/lustre/ptlrpc/client.c
index dc9e406f3212..8c1ec830712f 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/client.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/client.c
@@ -1497,11 +1497,13 @@ static inline int ptlrpc_set_producer(struct ptlrpc_request_set *set)
1497int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set) 1497int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
1498{ 1498{
1499 struct list_head *tmp, *next; 1499 struct list_head *tmp, *next;
1500 struct list_head comp_reqs;
1500 int force_timer_recalc = 0; 1501 int force_timer_recalc = 0;
1501 1502
1502 if (atomic_read(&set->set_remaining) == 0) 1503 if (atomic_read(&set->set_remaining) == 0)
1503 return 1; 1504 return 1;
1504 1505
1506 INIT_LIST_HEAD(&comp_reqs);
1505 list_for_each_safe(tmp, next, &set->set_requests) { 1507 list_for_each_safe(tmp, next, &set->set_requests) {
1506 struct ptlrpc_request *req = 1508 struct ptlrpc_request *req =
1507 list_entry(tmp, struct ptlrpc_request, 1509 list_entry(tmp, struct ptlrpc_request,
@@ -1576,8 +1578,10 @@ int ptlrpc_check_set(const struct lu_env *env, struct ptlrpc_request_set *set)
1576 ptlrpc_rqphase_move(req, req->rq_next_phase); 1578 ptlrpc_rqphase_move(req, req->rq_next_phase);
1577 } 1579 }
1578 1580
1579 if (req->rq_phase == RQ_PHASE_COMPLETE) 1581 if (req->rq_phase == RQ_PHASE_COMPLETE) {
1582 list_move_tail(&req->rq_set_chain, &comp_reqs);
1580 continue; 1583 continue;
1584 }
1581 1585
1582 if (req->rq_phase == RQ_PHASE_INTERPRET) 1586 if (req->rq_phase == RQ_PHASE_INTERPRET)
1583 goto interpret; 1587 goto interpret;
@@ -1860,9 +1864,15 @@ interpret:
1860 if (req->rq_status != 0) 1864 if (req->rq_status != 0)
1861 set->set_rc = req->rq_status; 1865 set->set_rc = req->rq_status;
1862 ptlrpc_req_finished(req); 1866 ptlrpc_req_finished(req);
1867 } else {
1868 list_move_tail(&req->rq_set_chain, &comp_reqs);
1863 } 1869 }
1864 } 1870 }
1865 1871
1872 /* move completed request at the head of list so it's easier for
1873 * caller to find them */
1874 list_splice(&comp_reqs, &set->set_requests);
1875
1866 /* If we hit an error, we want to recover promptly. */ 1876 /* If we hit an error, we want to recover promptly. */
1867 return atomic_read(&set->set_remaining) == 0 || force_timer_recalc; 1877 return atomic_read(&set->set_remaining) == 0 || force_timer_recalc;
1868} 1878}
diff --git a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
index cbcc541cac43..4621b71fe0b6 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/ptlrpcd.c
@@ -306,21 +306,16 @@ static int ptlrpcd_check(struct lu_env *env, struct ptlrpcd_ctl *pc)
306 if (atomic_read(&set->set_remaining)) 306 if (atomic_read(&set->set_remaining))
307 rc |= ptlrpc_check_set(env, set); 307 rc |= ptlrpc_check_set(env, set);
308 308
309 if (!list_empty(&set->set_requests)) { 309 /* NB: ptlrpc_check_set has already moved completed request at the
310 /* 310 * head of seq::set_requests */
311 * XXX: our set never completes, so we prune the completed 311 list_for_each_safe(pos, tmp, &set->set_requests) {
312 * reqs after each iteration. boy could this be smarter. 312 req = list_entry(pos, struct ptlrpc_request, rq_set_chain);
313 */ 313 if (req->rq_phase != RQ_PHASE_COMPLETE)
314 list_for_each_safe(pos, tmp, &set->set_requests) { 314 break;
315 req = list_entry(pos, struct ptlrpc_request,
316 rq_set_chain);
317 if (req->rq_phase != RQ_PHASE_COMPLETE)
318 continue;
319 315
320 list_del_init(&req->rq_set_chain); 316 list_del_init(&req->rq_set_chain);
321 req->rq_set = NULL; 317 req->rq_set = NULL;
322 ptlrpc_req_finished(req); 318 ptlrpc_req_finished(req);
323 }
324 } 319 }
325 320
326 if (rc == 0) { 321 if (rc == 0) {