Home Home > GIT Browse
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikolay Borisov <nborisov@suse.com>2019-08-14 17:11:18 +0300
committerNikolay Borisov <nborisov@suse.com>2019-08-14 17:11:28 +0300
commit2eb4a539db78c0f627e9d4630e0705c981f1be27 (patch)
tree5bbb00359e0680810d0315276df75f008ba70af9
parentcfda297438431993acc3286e9c1351fbf8fd0da2 (diff)
xfs: dump transaction usage details on log reservation overrun
(bsc#1145235).
-rw-r--r--patches.suse/xfs-dump-transaction-usage-details-on-log-reservation-overrun.patch162
-rw-r--r--series.conf1
2 files changed, 163 insertions, 0 deletions
diff --git a/patches.suse/xfs-dump-transaction-usage-details-on-log-reservation-overrun.patch b/patches.suse/xfs-dump-transaction-usage-details-on-log-reservation-overrun.patch
new file mode 100644
index 0000000000..e0e3d666fd
--- /dev/null
+++ b/patches.suse/xfs-dump-transaction-usage-details-on-log-reservation-overrun.patch
@@ -0,0 +1,162 @@
+From: Brian Foster <bfoster@redhat.com>
+Date: Wed, 14 Jun 2017 21:29:50 -0700
+Subject: xfs: dump transaction usage details on log reservation overrun
+Git-commit: d4ca1d550d052accec85ae26ac5b9d3d8b8f81f1
+Patch-mainline: v4.13-rc1
+References: bsc#1145235
+
+If a transaction log reservation overrun occurs, the ticket data
+associated with the reservation is dumped in xfs_log_commit_cil().
+This occurs long after the transaction items and details have been
+removed from the transaction and effectively lost. This limited set
+of ticket data provides very little information to support debugging
+transaction overruns based on the typical report.
+
+To improve transaction log reservation overrun reporting, create a
+helper to dump transaction details such as log items, log vector
+data, etc., as well as the underlying ticket data for the
+transaction. Move the overrun detection from xfs_log_commit_cil() to
+xlog_cil_insert_items() so it occurs prior to migration of the
+logged items to the CIL. Call the new helper such that it is able to
+dump this transaction data before it is lost.
+
+Also, warn on overrun to provide callstack context for the offending
+transaction and include a few additional messages from
+xlog_cil_insert_items() to display the reservation consumed locally
+for overhead such as log vector headers, split region headers and
+the context ticket. This provides a complete general breakdown of
+the reservation consumption of a transaction when/if it happens to
+overrun the reservation.
+
+Signed-off-by: Brian Foster <bfoster@redhat.com>
+Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
+Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
+Acked-by: Nikolay Borisov <nborisov@suse.com>
+---
+ fs/xfs/xfs_log.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
+ fs/xfs/xfs_log_cil.c | 24 ++++++++++++++++++------
+ fs/xfs/xfs_log_priv.h | 1 +
+ 3 files changed, 68 insertions(+), 6 deletions(-)
+
+diff --git a/fs/xfs/xfs_log.c b/fs/xfs/xfs_log.c
+index 8b283f7cefea..c8d048103347 100644
+--- a/fs/xfs/xfs_log.c
++++ b/fs/xfs/xfs_log.c
+@@ -2047,6 +2047,55 @@ xlog_print_tic_res(
+ }
+ }
+
++/*
++ * Print a summary of the transaction.
++ */
++void
++xlog_print_trans(
++ struct xfs_trans *tp)
++{
++ struct xfs_mount *mp = tp->t_mountp;
++ struct xfs_log_item_desc *lidp;
++
++ /* dump core transaction and ticket info */
++ xfs_warn(mp, "transaction summary:");
++ xfs_warn(mp, " flags = 0x%x", tp->t_flags);
++
++ xlog_print_tic_res(mp, tp->t_ticket);
++
++ /* dump each log item */
++ list_for_each_entry(lidp, &tp->t_items, lid_trans) {
++ struct xfs_log_item *lip = lidp->lid_item;
++ struct xfs_log_vec *lv = lip->li_lv;
++ struct xfs_log_iovec *vec;
++ int i;
++
++ xfs_warn(mp, "log item: ");
++ xfs_warn(mp, " type = 0x%x", lip->li_type);
++ xfs_warn(mp, " flags = 0x%x", lip->li_flags);
++ if (!lv)
++ continue;
++ xfs_warn(mp, " niovecs = %d", lv->lv_niovecs);
++ xfs_warn(mp, " size = %d", lv->lv_size);
++ xfs_warn(mp, " bytes = %d", lv->lv_bytes);
++ xfs_warn(mp, " buf len = %d", lv->lv_buf_len);
++
++ /* dump each iovec for the log item */
++ vec = lv->lv_iovecp;
++ for (i = 0; i < lv->lv_niovecs; i++) {
++ int dumplen = min(vec->i_len, 32);
++
++ xfs_warn(mp, " iovec[%d]", i);
++ xfs_warn(mp, " type = 0x%x", vec->i_type);
++ xfs_warn(mp, " len = %d", vec->i_len);
++ xfs_warn(mp, " first %d bytes of iovec[%d]:", dumplen, i);
++ xfs_hex_dump(vec->i_addr, dumplen);;
++
++ vec++;
++ }
++ }
++}
++
+ /*
+ * Calculate the potential space needed by the log vector. Each region gets
+ * its own xlog_op_header_t and may need to be double word aligned.
+diff --git a/fs/xfs/xfs_log_cil.c b/fs/xfs/xfs_log_cil.c
+index 8de3baa7d3f0..04b389210cc7 100644
+--- a/fs/xfs/xfs_log_cil.c
++++ b/fs/xfs/xfs_log_cil.c
+@@ -459,6 +459,21 @@ xlog_cil_insert_items(
+ tp->t_ticket->t_curr_res -= len;
+ ctx->space_used += len;
+
++ /*
++ * If we've overrun the reservation, dump the tx details before we move
++ * the log items. Shutdown is imminent...
++ */
++ if (WARN_ON(tp->t_ticket->t_curr_res < 0)) {
++ xfs_warn(log->l_mp, "Transaction log reservation overrun:");
++ xfs_warn(log->l_mp,
++ " log items: %d bytes (iov hdrs: %d bytes)",
++ len, iovhdr_res);
++ xfs_warn(log->l_mp, " split region headers: %d bytes",
++ split_res);
++ xfs_warn(log->l_mp, " ctx ticket: %d bytes", ctx_res);
++ xlog_print_trans(tp);
++ }
++
+ /*
+ * Now (re-)position everything modified at the tail of the CIL.
+ * We do this here so we only need to take the CIL lock once during
+@@ -481,6 +496,9 @@ xlog_cil_insert_items(
+ }
+
+ spin_unlock(&cil->xc_cil_lock);
++
++ if (tp->t_ticket->t_curr_res < 0)
++ xfs_force_shutdown(log->l_mp, SHUTDOWN_LOG_IO_ERROR);
+ }
+
+ static void
+@@ -988,12 +1006,6 @@ xfs_log_commit_cil(
+
+ xlog_cil_insert_items(log, tp);
+
+- /* check we didn't blow the reservation */
+- if (tp->t_ticket->t_curr_res < 0) {
+- xlog_print_tic_res(mp, tp->t_ticket);
+- xfs_force_shutdown(log->l_mp, SHUTDOWN_LOG_IO_ERROR);
+- }
+-
+ tp->t_commit_lsn = cil->xc_ctx->sequence;
+ if (commit_lsn)
+ *commit_lsn = tp->t_commit_lsn;
+diff --git a/fs/xfs/xfs_log_priv.h b/fs/xfs/xfs_log_priv.h
+index c2604a5366f2..62113a5d2504 100644
+--- a/fs/xfs/xfs_log_priv.h
++++ b/fs/xfs/xfs_log_priv.h
+@@ -456,6 +456,7 @@ xlog_write_adv_cnt(void **ptr, int *len, int *off, size_t bytes)
+ }
+
+ void xlog_print_tic_res(struct xfs_mount *mp, struct xlog_ticket *ticket);
++void xlog_print_trans(struct xfs_trans *);
+ int
+ xlog_write(
+ struct xlog *log,
+
diff --git a/series.conf b/series.conf
index 64a714d68f..a15ba5958b 100644
--- a/series.conf
+++ b/series.conf
@@ -3577,6 +3577,7 @@
patches.fixes/0058-xfs-refactor-dir2-leaf-readahead-shadow-buffer-cleve.patch
patches.suse/xfs-separate-shutdown-from-ticket-reservation-print-helper.patch
patches.suse/xfs-refactor-xlog_cil_insert_items-to-facilitate-transaction-dump.patch
+ patches.suse/xfs-dump-transaction-usage-details-on-log-reservation-overrun.patch
patches.fixes/xfs-release-bli-from-transaction-properly-on-fs-shut.patch
patches.fixes/xfs-remove-bli-from-AIL-before-release-on-transactio.patch
patches.fixes/xfs-remove-double-underscore-integer-types.patch