Whamcloud - gitweb
LU-15420 build: fixes to support building on Ubuntu 22.04 LTS
[fs/lustre-release.git] / lustre / target / update_trans.c
index 863d52f..aa13f94 100644 (file)
@@ -1026,6 +1026,17 @@ stop_master_trans:
        /* Step 3: write updates to other MDTs */
        if (write_updates) {
                struct llog_update_record *lur;
+               if (OBD_FAIL_PRECHECK(OBD_FAIL_OUT_OBJECT_MISS)) {
+                       if (cfs_fail_val == 1) {
+                               long timeout = cfs_time_seconds(1) / 10;
+
+                               OBD_RACE(OBD_FAIL_OUT_OBJECT_MISS);
+                               set_current_state(TASK_UNINTERRUPTIBLE);
+                               schedule_timeout(schedule_timeout(timeout));
+                               cfs_fail_loc = 0;
+                       }
+                       cfs_fail_val++;
+               }
 
                /* Stop callback of master will add more updates and also update
                 * master transno, so merge the parameters and updates into one
@@ -1272,6 +1283,9 @@ static int distribute_txn_cancel_records(const struct lu_env *env,
        struct sub_thandle *st;
        ENTRY;
 
+       if (OBD_FAIL_CHECK(OBD_FAIL_TGT_TXN_NO_CANCEL))
+               RETURN(0);
+
        top_multiple_thandle_dump(tmt, D_INFO);
        /* Cancel update logs on other MDTs */
        list_for_each_entry(st, &tmt->tmt_sub_thandle_list, st_sub_list) {
@@ -1330,7 +1344,7 @@ static void distribute_txn_batchid_cb(struct lu_env *env,
        struct distribute_txn_bid_data          *dtbd = NULL;
        struct target_distribute_txn_data       *tdtd;
 
-       dtbd = container_of0(cb, struct distribute_txn_bid_data, dtbd_cb);
+       dtbd = container_of(cb, struct distribute_txn_bid_data, dtbd_cb);
        tdtd = dtbd->dtbd_tdtd;
 
        CDEBUG(D_HA, "%s: %llu batchid updated\n",
@@ -1576,7 +1590,6 @@ static int distribute_txn_commit_thread(void *_arg)
                       tdtd->tdtd_committed_batchid);
                /* update globally committed on a storage */
                if (batchid > tdtd->tdtd_committed_batchid) {
-                       __set_current_state(TASK_RUNNING);
                        rc = distribute_txn_commit_batchid_update(env, tdtd,
                                                             batchid);
                        if (rc == 0)
@@ -1595,8 +1608,13 @@ static int distribute_txn_commit_thread(void *_arg)
                        top_multiple_thandle_put(tmt);
                }
 
-               if (current->state)
+               if (!task_is_running(current))
                        schedule();
+
+               if (OBD_FAIL_PRECHECK(OBD_FAIL_OUT_OBJECT_MISS)) {
+                       set_current_state(TASK_UNINTERRUPTIBLE);
+                       schedule_timeout(cfs_time_seconds(5));
+               }
        }
 
        while (({set_current_state(TASK_IDLE);