/* Don't account for regions with embedded ophdrs */
        if (optype && headers > 0) {
-               if (optype & XLOG_UNMOUNT_TRANS)
-                       headers--;
+               headers--;
                if (optype & XLOG_START_TRANS) {
-                       ASSERT(headers >= 2);
-                       headers -= 2;
+                       ASSERT(headers >= 1);
+                       headers--;
                }
        }
 
        int                     data_cnt = 0;
        int                     error = 0;
 
-       /*
-        * If this is a commit or unmount transaction, we don't need a start
-        * record to be written.  We do, however, have to account for the commit
-        * header that gets written. Hence we always have to account for an
-        * extra xlog_op_header here for commit records.
-        */
-       if (optype & XLOG_COMMIT_TRANS)
-               ticket->t_curr_res -= sizeof(struct xlog_op_header);
        if (ticket->t_curr_res < 0) {
                xfs_alert_tag(log->l_mp, XFS_PTAG_LOGRES,
                     "ctx ticket reservation ran out. Need to up reservation");
                        /*
                         * The XLOG_START_TRANS has embedded ophdrs for the
                         * start record and transaction header. They will always
-                        * be the first two regions in the lv chain.
+                        * be the first two regions in the lv chain. Commit and
+                        * unmount records also have embedded ophdrs.
                         */
-                       if (optype & XLOG_START_TRANS) {
+                       if (optype) {
                                ophdr = reg->i_addr;
                                if (index)
                                        optype &= ~XLOG_START_TRANS;
-                       } else if (optype & XLOG_UNMOUNT_TRANS) {
-                               ophdr = reg->i_addr;
                        } else {
                                ophdr = xlog_write_setup_ophdr(log, ptr,
                                                        ticket, optype);
 
        struct xfs_cil_ctx      *ctx)
 {
        struct xlog             *log = ctx->cil->xc_log;
+       struct xlog_op_header   ophdr = {
+               .oh_clientid = XFS_TRANSACTION,
+               .oh_tid = cpu_to_be32(ctx->ticket->t_tid),
+               .oh_flags = XLOG_COMMIT_TRANS,
+       };
        struct xfs_log_iovec    reg = {
-               .i_addr = NULL,
-               .i_len = 0,
+               .i_addr = &ophdr,
+               .i_len = sizeof(struct xlog_op_header),
                .i_type = XLOG_REG_TYPE_COMMIT,
        };
        struct xfs_log_vec      vec = {
        if (error)
                return error;
 
+       /* account for space used by record data */
+       ctx->ticket->t_curr_res -= reg.i_len;
        error = xlog_write(log, ctx, &vec, ctx->ticket, XLOG_COMMIT_TRANS);
        if (error)
                xlog_force_shutdown(log, SHUTDOWN_LOG_IO_ERROR);