Whamcloud - gitweb
LU-5188 osp: return 1 if osp_sync_xxx_job issue RPC 28/10828/4
authorWang Di <di.wang@intel.com>
Wed, 25 Jun 2014 23:06:55 +0000 (16:06 -0700)
committerAndreas Dilger <andreas.dilger@intel.com>
Fri, 27 Jun 2014 17:33:59 +0000 (17:33 +0000)
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 <di.wang@intel.com>
Reviewed-on: http://review.whamcloud.com/10828
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Alex Zhuravlev <alexey.zhuravlev@intel.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/osp/osp_sync.c

index 1dd8e85..8713ff0 100644 (file)
@@ -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--;