From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: linux-xfs@vger.kernel.org, david@fromorbit.com,
Christoph Hellwig <hch@infradead.org>
Subject: [PATCH v2 3/3] xfs: xfs_defer_capture should absorb remaining transaction reservation
Date: Wed, 23 Sep 2020 23:03:19 -0700 [thread overview]
Message-ID: <20200924060319.GB7955@magnolia> (raw)
In-Reply-To: <160031335967.3624461.12775342036527430147.stgit@magnolia>
From: Darrick J. Wong <darrick.wong@oracle.com>
When xfs_defer_capture extracts the deferred ops and transaction state
from a transaction, it should record the transaction reservation type
from the old transaction so that when we continue the dfops chain, we
still use the same reservation parameters.
This avoids a potential failure vector by ensuring that we never ask for
more log reservation space than we would have asked for had the system
not gone down.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
v2: rebased on v2 of patch 1
---
fs/xfs/libxfs/xfs_defer.c | 3 +++
fs/xfs/libxfs/xfs_defer.h | 1 +
fs/xfs/xfs_log_recover.c | 4 ++--
3 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_defer.c b/fs/xfs/libxfs/xfs_defer.c
index 8bd01952c955..b693d2c42c27 100644
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -595,6 +595,9 @@ xfs_defer_capture(
dfc->dfc_tpflags = tp->t_flags & XFS_TRANS_LOWMODE;
dfc->dfc_blkres = tp->t_blk_res - tp->t_blk_res_used;
tp->t_blk_res = tp->t_blk_res_used;
+ dfc->dfc_tres.tr_logres = tp->t_log_res;
+ dfc->dfc_tres.tr_logcount = tp->t_log_count;
+ dfc->dfc_tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
xfs_defer_reset(tp);
/*
diff --git a/fs/xfs/libxfs/xfs_defer.h b/fs/xfs/libxfs/xfs_defer.h
index 59d126aeb31c..254d48e6e4dc 100644
--- a/fs/xfs/libxfs/xfs_defer.h
+++ b/fs/xfs/libxfs/xfs_defer.h
@@ -77,6 +77,7 @@ struct xfs_defer_capture {
struct list_head dfc_dfops;
unsigned int dfc_tpflags;
unsigned int dfc_blkres;
+ struct xfs_trans_res dfc_tres;
};
/*
diff --git a/fs/xfs/xfs_log_recover.c b/fs/xfs/xfs_log_recover.c
index 777b60073ff7..ab9825ab14d5 100644
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2504,8 +2504,8 @@ xlog_finish_defer_ops(
int error = 0;
list_for_each_entry_safe(dfc, next, capture_list, dfc_list) {
- error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0,
- 0, XFS_TRANS_RESERVE, &tp);
+ error = xfs_trans_alloc(mp, &dfc->dfc_tres, 0, 0,
+ XFS_TRANS_RESERVE, &tp);
if (error)
return error;
prev parent reply other threads:[~2020-09-24 6:05 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 3:29 [PATCH 0/3] xfs: fix how we deal with new intents during recovery Darrick J. Wong
2020-09-17 3:29 ` [PATCH 1/3] xfs: proper replay of deferred ops queued during log recovery Darrick J. Wong
2020-09-23 7:48 ` Christoph Hellwig
2020-09-23 15:46 ` Darrick J. Wong
2020-09-24 6:02 ` [PATCH v2 " Darrick J. Wong
2020-09-25 12:21 ` Brian Foster
2020-09-25 19:19 ` Darrick J. Wong
2020-09-17 3:29 ` [PATCH 2/3] xfs: xfs_defer_capture should absorb remaining block reservation Darrick J. Wong
2020-09-23 7:49 ` Christoph Hellwig
2020-09-24 6:04 ` [PATCH v2 " Darrick J. Wong
2020-09-17 3:29 ` [PATCH 3/3] xfs: xfs_defer_capture should absorb remaining transaction reservation Darrick J. Wong
2020-09-23 7:49 ` Christoph Hellwig
2020-09-23 15:22 ` Darrick J. Wong
2020-09-24 6:03 ` Darrick J. Wong [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200924060319.GB7955@magnolia \
--to=darrick.wong@oracle.com \
--cc=david@fromorbit.com \
--cc=hch@infradead.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).