Print this page
3747 txg commit callbacks don't work
Submitted by:   Will Andrews <willa@spectralogic.com>
Reviewed by:    Matthew Ahrens <mahrens@delphix.com>


4496                     old_txg, txg);
4497 
4498         dmu_write(os, od[0].od_object, 0, sizeof (uint64_t), &txg, tx);
4499 
4500         (void) mutex_lock(&zcl.zcl_callbacks_lock);
4501 
4502         /*
4503          * Since commit callbacks don't have any ordering requirement and since
4504          * it is theoretically possible for a commit callback to be called
4505          * after an arbitrary amount of time has elapsed since its txg has been
4506          * synced, it is difficult to reliably determine whether a commit
4507          * callback hasn't been called due to high load or due to a flawed
4508          * implementation.
4509          *
4510          * In practice, we will assume that if after a certain number of txgs a
4511          * commit callback hasn't been called, then most likely there's an
4512          * implementation bug..
4513          */
4514         tmp_cb = list_head(&zcl.zcl_callbacks);
4515         if (tmp_cb != NULL &&
4516             tmp_cb->zcd_txg > txg - ZTEST_COMMIT_CALLBACK_THRESH) {
4517                 fatal(0, "Commit callback threshold exceeded, oldest txg: %"
4518                     PRIu64 ", open txg: %" PRIu64 "\n", tmp_cb->zcd_txg, txg);
4519         }
4520 
4521         /*
4522          * Let's find the place to insert our callbacks.
4523          *
4524          * Even though the list is ordered by txg, it is possible for the
4525          * insertion point to not be the end because our txg may already be
4526          * quiescing at this point and other callbacks in the open txg
4527          * (from other objsets) may have sneaked in.
4528          */
4529         tmp_cb = list_tail(&zcl.zcl_callbacks);
4530         while (tmp_cb != NULL && tmp_cb->zcd_txg > txg)
4531                 tmp_cb = list_prev(&zcl.zcl_callbacks, tmp_cb);
4532 
4533         /* Add the 3 callbacks to the list */
4534         for (i = 0; i < 3; i++) {
4535                 if (tmp_cb == NULL)
4536                         list_insert_head(&zcl.zcl_callbacks, cb_data[i]);




4496                     old_txg, txg);
4497 
4498         dmu_write(os, od[0].od_object, 0, sizeof (uint64_t), &txg, tx);
4499 
4500         (void) mutex_lock(&zcl.zcl_callbacks_lock);
4501 
4502         /*
4503          * Since commit callbacks don't have any ordering requirement and since
4504          * it is theoretically possible for a commit callback to be called
4505          * after an arbitrary amount of time has elapsed since its txg has been
4506          * synced, it is difficult to reliably determine whether a commit
4507          * callback hasn't been called due to high load or due to a flawed
4508          * implementation.
4509          *
4510          * In practice, we will assume that if after a certain number of txgs a
4511          * commit callback hasn't been called, then most likely there's an
4512          * implementation bug..
4513          */
4514         tmp_cb = list_head(&zcl.zcl_callbacks);
4515         if (tmp_cb != NULL &&
4516             (txg - ZTEST_COMMIT_CALLBACK_THRESH) > tmp_cb->zcd_txg) {
4517                 fatal(0, "Commit callback threshold exceeded, oldest txg: %"
4518                     PRIu64 ", open txg: %" PRIu64 "\n", tmp_cb->zcd_txg, txg);
4519         }
4520 
4521         /*
4522          * Let's find the place to insert our callbacks.
4523          *
4524          * Even though the list is ordered by txg, it is possible for the
4525          * insertion point to not be the end because our txg may already be
4526          * quiescing at this point and other callbacks in the open txg
4527          * (from other objsets) may have sneaked in.
4528          */
4529         tmp_cb = list_tail(&zcl.zcl_callbacks);
4530         while (tmp_cb != NULL && tmp_cb->zcd_txg > txg)
4531                 tmp_cb = list_prev(&zcl.zcl_callbacks, tmp_cb);
4532 
4533         /* Add the 3 callbacks to the list */
4534         for (i = 0; i < 3; i++) {
4535                 if (tmp_cb == NULL)
4536                         list_insert_head(&zcl.zcl_callbacks, cb_data[i]);