Whamcloud - gitweb
LU-12635 build: Support for gcc -Wimplicit-fallthrough
[fs/lustre-release.git] / lustre / target / update_trans.c
index 76153b1..b8150fa 100644 (file)
@@ -20,7 +20,7 @@
  * GPL HEADER END
  */
 /*
- * Copyright (c) 2015, 2016, Intel Corporation.
+ * Copyright (c) 2015, 2017, Intel Corporation.
  */
 /*
  * lustre/target/update_trans.c
@@ -82,9 +82,11 @@ static void top_multiple_thandle_dump(struct top_multiple_thandle *tmt,
        list_for_each_entry(st, &tmt->tmt_sub_thandle_list, st_sub_list) {
                struct sub_thandle_cookie *stc;
 
-               CDEBUG(mask, "st %p obd %s committed %d stopped %d sub_th %p\n",
+               CDEBUG(mask, "st %p obd %s committed %d started %d stopped %d "
+                      "result %d sub_th %p\n",
                       st, st->st_dt->dd_lu_dev.ld_obd->obd_name,
-                      st->st_committed, st->st_stopped, st->st_sub_th);
+                      st->st_committed, st->st_started, st->st_stopped,
+                      st->st_result, st->st_sub_th);
 
                list_for_each_entry(stc, &st->st_cookie_list, stc_list) {
                        CDEBUG(mask, " cookie "DFID".%u\n",
@@ -526,6 +528,7 @@ static void sub_trans_stop_cb(struct lu_env *env,
        struct top_multiple_thandle     *tmt = cb->dcb_data;
        ENTRY;
 
+       spin_lock(&tmt->tmt_sub_lock);
        list_for_each_entry(st, &tmt->tmt_sub_thandle_list, st_sub_list) {
                if (st->st_stopped)
                        continue;
@@ -536,6 +539,7 @@ static void sub_trans_stop_cb(struct lu_env *env,
                        break;
                }
        }
+       spin_unlock(&tmt->tmt_sub_lock);
 
        wake_up(&tmt->tmt_stop_waitq);
        RETURN_EXIT;
@@ -615,8 +619,6 @@ top_trans_create(const struct lu_env *env, struct dt_device *master_dev)
                child_th->th_top = &top_th->tt_super;
                child_th->th_wait_submit = 1;
                top_th->tt_master_sub_thandle = child_th;
-
-               top_th->tt_super.th_tags |= child_th->th_tags;
        }
        return &top_th->tt_super;
 }
@@ -795,7 +797,6 @@ int top_trans_start(const struct lu_env *env, struct dt_device *master_dev,
                        top_th->tt_master_sub_thandle->th_sync = th->th_sync;
                if (th->th_local)
                        top_th->tt_master_sub_thandle->th_local = th->th_local;
-               top_th->tt_master_sub_thandle->th_tags = th->th_tags;
                rc = dt_trans_start(env, top_th->tt_master_sub_thandle->th_dev,
                                    top_th->tt_master_sub_thandle);
                RETURN(rc);
@@ -813,7 +814,6 @@ int top_trans_start(const struct lu_env *env, struct dt_device *master_dev,
                        st->st_sub_th->th_sync = th->th_sync;
                if (th->th_local)
                        st->st_sub_th->th_local = th->th_local;
-               st->st_sub_th->th_tags = th->th_tags;
                rc = dt_trans_start(env, st->st_sub_th->th_dev,
                                    st->st_sub_th);
                if (rc != 0)
@@ -951,7 +951,6 @@ int top_trans_stop(const struct lu_env *env, struct dt_device *master_dev,
                        top_th->tt_master_sub_thandle->th_sync = th->th_sync;
                if (th->th_local)
                        top_th->tt_master_sub_thandle->th_local = th->th_local;
-               top_th->tt_master_sub_thandle->th_tags = th->th_tags;
                rc = dt_trans_stop(env, master_dev,
                                   top_th->tt_master_sub_thandle);
                OBD_FREE_PTR(top_th);
@@ -1011,7 +1010,6 @@ stop_master_trans:
                        master_st->st_sub_th->th_local = th->th_local;
                if (th->th_sync)
                        master_st->st_sub_th->th_sync = th->th_sync;
-               master_st->st_sub_th->th_tags = th->th_tags;
                master_st->st_sub_th->th_result = th->th_result;
                rc = dt_trans_stop(env, master_st->st_dt, master_st->st_sub_th);
                /* If it does not write_updates, then we call submit callback
@@ -1022,6 +1020,8 @@ stop_master_trans:
                        sub_trans_commit_cb_internal(tmt,
                                                master_st->st_sub_th, rc);
                if (rc < 0) {
+                       CERROR("%s: stop trans failed: rc = %d\n",
+                              master_dev->dd_lu_dev.ld_obd->obd_name, rc);
                        th->th_result = rc;
                        GOTO(stop_other_trans, rc);
                } else if (tur != NULL && tur->tur_update_records != NULL) {
@@ -1059,6 +1059,9 @@ stop_master_trans:
 
                        rc = sub_updates_write(env, lur, st);
                        if (rc < 0) {
+                               CERROR("%s: write updates failed: rc = %d\n",
+                                      st->st_dt->dd_lu_dev.ld_obd->obd_name,
+                                      rc);
                                th->th_result = rc;
                                break;
                        }
@@ -1075,12 +1078,15 @@ stop_other_trans:
                        st->st_sub_th->th_sync = th->th_sync;
                if (th->th_local)
                        st->st_sub_th->th_local = th->th_local;
-               st->st_sub_th->th_tags = th->th_tags;
                st->st_sub_th->th_result = th->th_result;
                rc = dt_trans_stop(env, st->st_sub_th->th_dev,
                                   st->st_sub_th);
-               if (unlikely(rc < 0 && th->th_result == 0))
-                       th->th_result = rc;
+               if (rc < 0) {
+                       CERROR("%s: stop trans failed: rc = %d\n",
+                              st->st_dt->dd_lu_dev.ld_obd->obd_name, rc);
+                       if (th->th_result == 0)
+                               th->th_result = rc;
+               }
        }
 
        rc = top_trans_wait_result(top_th);