Whamcloud - gitweb
LU-7329 obdclass: sync device to flush journal callbacks 52/17052/3
authorBruno Faccini <bruno.faccini@intel.com>
Thu, 5 Nov 2015 15:44:52 +0000 (16:44 +0100)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 30 Nov 2015 18:12:25 +0000 (18:12 +0000)
After llog_test_10() has been added to check correct Catalog
wrap-around as part of LU-6556, frequent auto-tests failures
have been encountered due to OOM situation on VMs caused by
a lot of journal commit callbacks backlog induced by the huge
LLOG activity generated by new test.
This patch forces frequent device sync to flush these journal
commit callbacks.

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: If06914a395f5bacbbb55fcdc229ffcd47d742843
Reviewed-on: http://review.whamcloud.com/17052
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Mike Pershin <mike.pershin@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/llog_test.c

index 3629397..a6ab973 100644 (file)
@@ -1397,6 +1397,7 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
        struct llog_ctxt        *ctxt;
        struct lu_attr           la;
        __u64                    cat_max_size;
        struct llog_ctxt        *ctxt;
        struct lu_attr           la;
        __u64                    cat_max_size;
+       struct dt_device        *dt;
 
        ENTRY;
 
 
        ENTRY;
 
@@ -1420,6 +1421,7 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
        }
 
        cat_logid = cath->lgh_id;
        }
 
        cat_logid = cath->lgh_id;
+       dt = lu2dt_dev(cath->lgh_obj->do_lu.lo_dev);
 
        /* force catalog wrap for 5th plain LLOG */
        cfs_fail_loc = CFS_FAIL_SKIP|OBD_FAIL_CAT_RECORDS;
 
        /* force catalog wrap for 5th plain LLOG */
        cfs_fail_loc = CFS_FAIL_SKIP|OBD_FAIL_CAT_RECORDS;
@@ -1440,6 +1442,15 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
        if (rc)
                GOTO(out, rc);
 
        if (rc)
                GOTO(out, rc);
 
+       /* sync device to commit all recent LLOG changes to disk and avoid
+        * to consume a huge space with delayed journal commit callbacks
+        * particularly on low memory nodes or VMs */
+       rc = dt_sync(env, dt);
+       if (rc) {
+               CERROR("10b: sync failed: %d\n", rc);
+               GOTO(out, rc);
+       }
+
        CWARN("10c: write %d more log records\n", 2 * LLOG_TEST_RECNUM);
        for (i = 0; i < 2 * LLOG_TEST_RECNUM; i++) {
                rc = llog_cat_add(env, cath, &lmr.lmr_hdr, NULL);
        CWARN("10c: write %d more log records\n", 2 * LLOG_TEST_RECNUM);
        for (i = 0; i < 2 * LLOG_TEST_RECNUM; i++) {
                rc = llog_cat_add(env, cath, &lmr.lmr_hdr, NULL);
@@ -1455,6 +1466,15 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
        if (rc)
                GOTO(out, rc);
 
        if (rc)
                GOTO(out, rc);
 
+       /* sync device to commit all recent LLOG changes to disk and avoid
+        * to consume a huge space with delayed journal commit callbacks
+        * particularly on low memory nodes or VMs */
+       rc = dt_sync(env, dt);
+       if (rc) {
+               CERROR("10c: sync failed: %d\n", rc);
+               GOTO(out, rc);
+       }
+
        /* fill last allocated plain LLOG and reach -ENOSPC condition
         * because no slot available in Catalog */
        enospc = 0;
        /* fill last allocated plain LLOG and reach -ENOSPC condition
         * because no slot available in Catalog */
        enospc = 0;
@@ -1530,6 +1550,15 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
        if (rc)
                GOTO(out, rc);
 
        if (rc)
                GOTO(out, rc);
 
+       /* sync device to commit all recent LLOG changes to disk and avoid
+        * to consume a huge space with delayed journal commit callbacks
+        * particularly on low memory nodes or VMs */
+       rc = dt_sync(env, dt);
+       if (rc) {
+               CERROR("10d: sync failed: %d\n", rc);
+               GOTO(out, rc);
+       }
+
        enospc = 0;
        eok = 0;
        CWARN("10e: write %d more log records\n", LLOG_TEST_RECNUM);
        enospc = 0;
        eok = 0;
        CWARN("10e: write %d more log records\n", LLOG_TEST_RECNUM);
@@ -1597,6 +1626,15 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
        CWARN("10e: catalog successfully wrap around, last_idx %d, first %d\n",
              cath->lgh_last_idx, cath->lgh_hdr->llh_cat_idx);
 
        CWARN("10e: catalog successfully wrap around, last_idx %d, first %d\n",
              cath->lgh_last_idx, cath->lgh_hdr->llh_cat_idx);
 
+       /* sync device to commit all recent LLOG changes to disk and avoid
+        * to consume a huge space with delayed journal commit callbacks
+        * particularly on low memory nodes or VMs */
+       rc = dt_sync(env, dt);
+       if (rc) {
+               CERROR("10e: sync failed: %d\n", rc);
+               GOTO(out, rc);
+       }
+
        /* cancel more records to free one more slot in Catalog
         * see if it is re-allocated when adding more records */
        CWARN("10f: Cancel %d records, see one log zapped\n", LLOG_TEST_RECNUM);
        /* cancel more records to free one more slot in Catalog
         * see if it is re-allocated when adding more records */
        CWARN("10f: Cancel %d records, see one log zapped\n", LLOG_TEST_RECNUM);
@@ -1628,6 +1666,15 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
        if (rc)
                GOTO(out, rc);
 
        if (rc)
                GOTO(out, rc);
 
+       /* sync device to commit all recent LLOG changes to disk and avoid
+        * to consume a huge space with delayed journal commit callbacks
+        * particularly on low memory nodes or VMs */
+       rc = dt_sync(env, dt);
+       if (rc) {
+               CERROR("10f: sync failed: %d\n", rc);
+               GOTO(out, rc);
+       }
+
        enospc = 0;
        eok = 0;
        CWARN("10f: write %d more log records\n", LLOG_TEST_RECNUM);
        enospc = 0;
        eok = 0;
        CWARN("10f: write %d more log records\n", LLOG_TEST_RECNUM);
@@ -1683,6 +1730,15 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
                GOTO(out, rc = -EINVAL);
        }
 
                GOTO(out, rc = -EINVAL);
        }
 
+       /* sync device to commit all recent LLOG changes to disk and avoid
+        * to consume a huge space with delayed journal commit callbacks
+        * particularly on low memory nodes or VMs */
+       rc = dt_sync(env, dt);
+       if (rc) {
+               CERROR("10f: sync failed: %d\n", rc);
+               GOTO(out, rc);
+       }
+
        /* will llh_cat_idx also successfully wrap ? */
 
        /* cancel all records in the plain LLOGs referenced by 2 last indexes in
        /* will llh_cat_idx also successfully wrap ? */
 
        /* cancel all records in the plain LLOGs referenced by 2 last indexes in
@@ -1718,6 +1774,15 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
        if (rc)
                GOTO(out, rc);
 
        if (rc)
                GOTO(out, rc);
 
+       /* sync device to commit all recent LLOG changes to disk and avoid
+        * to consume a huge space with delayed journal commit callbacks
+        * particularly on low memory nodes or VMs */
+       rc = dt_sync(env, dt);
+       if (rc) {
+               CERROR("10g: sync failed: %d\n", rc);
+               GOTO(out, rc);
+       }
+
        /* cancel more records to free one more slot in Catalog */
        CWARN("10g: Cancel %d records, see one log zapped\n", LLOG_TEST_RECNUM);
        cancel_count = 0;
        /* cancel more records to free one more slot in Catalog */
        CWARN("10g: Cancel %d records, see one log zapped\n", LLOG_TEST_RECNUM);
        cancel_count = 0;
@@ -1756,6 +1821,15 @@ static int llog_test_10(const struct lu_env *env, struct obd_device *obd)
                GOTO(out, rc = -EINVAL);
        }
 
                GOTO(out, rc = -EINVAL);
        }
 
+       /* sync device to commit all recent LLOG changes to disk and avoid
+        * to consume a huge space with delayed journal commit callbacks
+        * particularly on low memory nodes or VMs */
+       rc = dt_sync(env, dt);
+       if (rc) {
+               CERROR("10g: sync failed: %d\n", rc);
+               GOTO(out, rc);
+       }
+
        /* cancel more records to free one more slot in Catalog */
        CWARN("10g: Cancel %d records, see one log zapped\n", LLOG_TEST_RECNUM);
        cancel_count = 0;
        /* cancel more records to free one more slot in Catalog */
        CWARN("10g: Cancel %d records, see one log zapped\n", LLOG_TEST_RECNUM);
        cancel_count = 0;