MCPcopy Create free account
hub / github.com/F-Stack/f-stack / zil_commit_writer_stall

Function zil_commit_writer_stall

freebsd/contrib/openzfs/module/zfs/zil.c:2202–2228  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2200}
2201
2202static void
2203zil_commit_writer_stall(zilog_t *zilog)
2204{
2205 /*
2206 * When zio_alloc_zil() fails to allocate the next lwb block on
2207 * disk, we must call txg_wait_synced() to ensure all of the
2208 * lwbs in the zilog's zl_lwb_list are synced and then freed (in
2209 * zil_sync()), such that any subsequent ZIL writer (i.e. a call
2210 * to zil_process_commit_list()) will have to call zil_create(),
2211 * and start a new ZIL chain.
2212 *
2213 * Since zil_alloc_zil() failed, the lwb that was previously
2214 * issued does not have a pointer to the "next" lwb on disk.
2215 * Thus, if another ZIL writer thread was to allocate the "next"
2216 * on-disk lwb, that block could be leaked in the event of a
2217 * crash (because the previous lwb on-disk would not point to
2218 * it).
2219 *
2220 * We must hold the zilog's zl_issuer_lock while we do this, to
2221 * ensure no new threads enter zil_process_commit_list() until
2222 * all lwb's in the zl_lwb_list have been synced and freed
2223 * (which is achieved via the txg_wait_synced() call).
2224 */
2225 ASSERT(MUTEX_HELD(&zilog->zl_issuer_lock));
2226 txg_wait_synced(zilog->zl_dmu_pool, 0);
2227 ASSERT3P(list_tail(&zilog->zl_lwb_list), ==, NULL);
2228}
2229
2230/*
2231 * This function will traverse the commit list, creating new lwbs as

Callers 2

zil_process_commit_listFunction · 0.85

Calls 2

txg_wait_syncedFunction · 0.85
list_tailFunction · 0.50

Tested by

no test coverage detected