From 73f47cdda42305df0be57e0ea6252eb6fd36db55 Mon Sep 17 00:00:00 2001 From: Wang Di Date: Wed, 25 Jun 2014 16:06:55 -0700 Subject: [PATCH] LU-5188 osp: return 1 if osp_sync_xxx_job issue RPC Return 1 if osp_sync_new_xxx_job() issue RPC, so sp_sync_process_record() can decrease opd_syn_rpc_in_flight and opd_syn_rpc_in_progress correctly if RPC is not being sent, otherwise the opd_sync_thread will not be stopped, caused LBUG (see LU-5244) osp_sync_thread()) ASSERTION( count < 10 ) failed: The problem is introduced by http://review.whamcloud.com/10706 Change-Id: Iaf6dd6c4e1938a0c5d44a40c303eda1695b72105 Signed-off-by: Wang Di Reviewed-on: http://review.whamcloud.com/10828 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger --- lustre/osp/osp_sync.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lustre/osp/osp_sync.c b/lustre/osp/osp_sync.c index 1dd8e85..8713ff0e3 100644 --- a/lustre/osp/osp_sync.c +++ b/lustre/osp/osp_sync.c @@ -514,10 +514,9 @@ static int osp_sync_new_setattr_job(struct osp_device *d, } osp_sync_send_new_rpc(d, req); - RETURN(0); + RETURN(1); } -/* Old records may be in old format, so we handle that too */ static int osp_sync_new_unlink_job(struct osp_device *d, struct llog_handle *llh, struct llog_rec_hdr *h) @@ -543,7 +542,7 @@ static int osp_sync_new_unlink_job(struct osp_device *d, body->oa.o_valid |= OBD_MD_FLOBJCOUNT; osp_sync_send_new_rpc(d, req); - RETURN(0); + RETURN(1); } static int osp_prep_unlink_update_req(const struct lu_env *env, @@ -643,7 +642,7 @@ static int osp_sync_new_unlink64_job(const struct lu_env *env, OBD_MD_FLOBJCOUNT; } osp_sync_send_new_rpc(d, req); - RETURN(0); + RETURN(1); } static int osp_sync_process_record(const struct lu_env *env, @@ -703,10 +702,10 @@ static int osp_sync_process_record(const struct lu_env *env, CERROR("%s: unknown record type: %x\n", d->opd_obd->obd_name, rec->lrh_type); /* we should continue processing */ - return 0; } - if (likely(rc == 0)) { + /* rc > 0 means sync RPC being added to the queue */ + if (likely(rc > 0)) { spin_lock(&d->opd_syn_lock); if (d->opd_syn_prev_done) { LASSERT(d->opd_syn_changes > 0); @@ -726,6 +725,7 @@ static int osp_sync_process_record(const struct lu_env *env, d->opd_obd->obd_name, d->opd_syn_rpc_in_flight, d->opd_syn_rpc_in_progress); spin_unlock(&d->opd_syn_lock); + rc = 0; } else { spin_lock(&d->opd_syn_lock); d->opd_syn_rpc_in_flight--; -- 1.8.3.1