diff --git a/include/sys/zil_impl.h b/include/sys/zil_impl.h index 5b7e596fa179..0ed12f8dc52d 100644 --- a/include/sys/zil_impl.h +++ b/include/sys/zil_impl.h @@ -129,9 +129,8 @@ struct zilog { uint_t zl_prev_blks[ZIL_PREV_BLKS]; /* size - sector rounded */ uint_t zl_prev_rotor; /* rotor for zl_prev[] */ txg_node_t zl_dirty_link; /* protected by dp_dirty_zilogs list */ - kmutex_t zl_writer_lock; /* protects two fields below */ + kmutex_t zl_writer_lock; /* protects writer list */ list_t zl_writer_list; /* list of writers */ - lwb_t *zl_last_lwb; /* lwb from previous pipeline stage */ }; /* diff --git a/module/zfs/zil.c b/module/zfs/zil.c index a60574e0f5f7..6e950279d360 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -1613,12 +1613,12 @@ zil_commit_writer(zilog_t *zilog) cv_wait(&prev->zilw_cv_waiter, &zilog->zl_writer_lock); } - lwb = zilog->zl_last_lwb; - - } else { - lwb = list_tail(&zilog->zl_lwb_list); } + mutex_enter(&zilog->zl_lock); + lwb = list_tail(&zilog->zl_lwb_list); + mutex_exit(&zilog->zl_lock); + if (lwb == NULL) lwb = zil_create(zilw); } @@ -1652,7 +1652,6 @@ zil_commit_writer(zilog_t *zilog) /* * Signal next thread, if any, for entry into the pipeline. */ - zilog->zl_last_lwb = lwb; mutex_enter(&zilog->zl_writer_lock); if (zilw->zilw_stage == 1) { zilw->zilw_stage = 2;