From 01ca899324738343279c1d63823b7fab937197dc Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Tue, 1 Sep 2015 17:28:46 +0300 Subject: [PATCH] LU-7079 ptlrpc: imp_peer_committed_transno should increase imp_peer_committed_transno should not decrease as this can confuse the users if imp_peer_committed_transno is used to check commit status. Change-Id: I8a1fdc651d837987bbe9aecc859b36849f9ee0a7 Signed-off-by: Alex Zhuravlev Reviewed-on: http://review.whamcloud.com/16161 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Mike Pershin Reviewed-by: wangdi Reviewed-by: Oleg Drokin --- lustre/osp/osp_sync.c | 11 +++++------ lustre/ptlrpc/client.c | 8 ++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index f0d785a..4b6d68a 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -937,7 +937,6 @@ static void osp_sync_process_committed(const struct lu_env *env, spin_unlock(&d->opd_syn_lock); while (!list_empty(&list)) { - struct llog_cookie *lcookie = NULL; struct osp_job_req_args *jra; jra = list_entry(list.next, struct osp_job_req_args, jra_link); @@ -949,18 +948,18 @@ static void osp_sync_process_committed(const struct lu_env *env, body = req_capsule_client_get(&req->rq_pill, &RMF_OST_BODY); LASSERT(body); - lcookie = &body->oa.o_lcookie; /* import can be closing, thus all commit cb's are * called we can check committness directly */ - if (req->rq_transno <= imp->imp_peer_committed_transno) { - rc = llog_cat_cancel_records(env, llh, 1, lcookie); + if (req->rq_import_generation == imp->imp_generation) { + rc = llog_cat_cancel_records(env, llh, 1, + &body->oa.o_lcookie); if (rc) CERROR("%s: can't cancel record: %d\n", obd->obd_name, rc); } else { - DEBUG_REQ(D_HA, req, "not committed"); + DEBUG_REQ(D_ERROR, req, "imp_committed = "LPU64, + imp->imp_peer_committed_transno); } - ptlrpc_req_finished(req); done++; } diff --git a/lustre/ptlrpc/client.c b/lustre/ptlrpc/client.c index 370c145..a791abf 100644 --- a/lustre/ptlrpc/client.c +++ b/lustre/ptlrpc/client.c @@ -1283,6 +1283,7 @@ static int after_reply(struct ptlrpc_request *req) struct obd_device *obd = req->rq_import->imp_obd; int rc; struct timeval work_start; + __u64 committed; long timediff; ENTRY; @@ -1437,10 +1438,9 @@ static int after_reply(struct ptlrpc_request *req) /* * Replay-enabled imports return commit-status information. */ - if (lustre_msg_get_last_committed(req->rq_repmsg)) { - imp->imp_peer_committed_transno = - lustre_msg_get_last_committed(req->rq_repmsg); - } + committed = lustre_msg_get_last_committed(req->rq_repmsg); + if (likely(committed > imp->imp_peer_committed_transno)) + imp->imp_peer_committed_transno = committed; ptlrpc_free_committed(imp); -- 1.8.3.1