* [PATCH] libxfs: propagate transaction block reservations
@ 2017-07-19 15:55 Darrick J. Wong
2017-07-19 16:18 ` Brian Foster
0 siblings, 1 reply; 2+ messages in thread
From: Darrick J. Wong @ 2017-07-19 15:55 UTC (permalink / raw)
To: Eric Sandeen; +Cc: xfs, Brian Foster
Certain parts of the libxfs preemptively refuse to run if the
transaction block reservation has fallen to zero. We leave t_blk_res at
its default of zero, which means that these code paths always fail even
if the transaction was allocated with a non-zero block reservation. Set
t_blk_res and maintain it through transaction rolls, even though we
don't do much enforcement the transaction block limits.
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
libxfs/trans.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/libxfs/trans.c b/libxfs/trans.c
index fe22cb9..035248f 100644
--- a/libxfs/trans.c
+++ b/libxfs/trans.c
@@ -106,6 +106,7 @@ libxfs_trans_roll(
struct xfs_mount *mp;
struct xfs_trans *trans;
struct xfs_trans_res tres;
+ unsigned int old_blk_res;
int error;
/*
@@ -121,6 +122,7 @@ libxfs_trans_roll(
mp = trans->t_mountp;
tres.tr_logres = trans->t_log_res;
tres.tr_logcount = trans->t_log_count;
+ old_blk_res = trans->t_blk_res;
/*
* Commit the current transaction.
@@ -145,6 +147,8 @@ libxfs_trans_roll(
tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
error = libxfs_trans_alloc(mp, &tres, 0, 0, 0, tpp);
trans = *tpp;
+ trans->t_blk_res = old_blk_res;
+
/*
* Ensure that the inode is in the new transaction and locked.
*/
@@ -185,6 +189,7 @@ libxfs_trans_alloc(
exit(1);
}
ptr->t_mountp = mp;
+ ptr->t_blk_res = blocks;
INIT_LIST_HEAD(&ptr->t_items);
#ifdef XACT_DEBUG
fprintf(stderr, "allocated new transaction %p\n", ptr);
@@ -750,7 +755,7 @@ trans_committed(
list_for_each_entry_safe(lidp, next, &tp->t_items, lid_trans) {
struct xfs_log_item *lip = lidp->lid_item;
- xfs_trans_del_item(lip);
+ xfs_trans_del_item(lip);
if (lip->li_type == XFS_LI_BUF)
buf_item_done((xfs_buf_log_item_t *)lip);
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] libxfs: propagate transaction block reservations
2017-07-19 15:55 [PATCH] libxfs: propagate transaction block reservations Darrick J. Wong
@ 2017-07-19 16:18 ` Brian Foster
0 siblings, 0 replies; 2+ messages in thread
From: Brian Foster @ 2017-07-19 16:18 UTC (permalink / raw)
To: Darrick J. Wong; +Cc: Eric Sandeen, xfs
On Wed, Jul 19, 2017 at 08:55:55AM -0700, Darrick J. Wong wrote:
> Certain parts of the libxfs preemptively refuse to run if the
> transaction block reservation has fallen to zero. We leave t_blk_res at
> its default of zero, which means that these code paths always fail even
> if the transaction was allocated with a non-zero block reservation. Set
> t_blk_res and maintain it through transaction rolls, even though we
> don't do much enforcement the transaction block limits.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
Reviewed-by: Brian Foster <bfoster@redhat.com>
> libxfs/trans.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/libxfs/trans.c b/libxfs/trans.c
> index fe22cb9..035248f 100644
> --- a/libxfs/trans.c
> +++ b/libxfs/trans.c
> @@ -106,6 +106,7 @@ libxfs_trans_roll(
> struct xfs_mount *mp;
> struct xfs_trans *trans;
> struct xfs_trans_res tres;
> + unsigned int old_blk_res;
> int error;
>
> /*
> @@ -121,6 +122,7 @@ libxfs_trans_roll(
> mp = trans->t_mountp;
> tres.tr_logres = trans->t_log_res;
> tres.tr_logcount = trans->t_log_count;
> + old_blk_res = trans->t_blk_res;
>
> /*
> * Commit the current transaction.
> @@ -145,6 +147,8 @@ libxfs_trans_roll(
> tres.tr_logflags = XFS_TRANS_PERM_LOG_RES;
> error = libxfs_trans_alloc(mp, &tres, 0, 0, 0, tpp);
> trans = *tpp;
> + trans->t_blk_res = old_blk_res;
> +
> /*
> * Ensure that the inode is in the new transaction and locked.
> */
> @@ -185,6 +189,7 @@ libxfs_trans_alloc(
> exit(1);
> }
> ptr->t_mountp = mp;
> + ptr->t_blk_res = blocks;
> INIT_LIST_HEAD(&ptr->t_items);
> #ifdef XACT_DEBUG
> fprintf(stderr, "allocated new transaction %p\n", ptr);
> @@ -750,7 +755,7 @@ trans_committed(
> list_for_each_entry_safe(lidp, next, &tp->t_items, lid_trans) {
> struct xfs_log_item *lip = lidp->lid_item;
>
> - xfs_trans_del_item(lip);
> + xfs_trans_del_item(lip);
>
> if (lip->li_type == XFS_LI_BUF)
> buf_item_done((xfs_buf_log_item_t *)lip);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-xfs" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-07-19 16:18 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-19 15:55 [PATCH] libxfs: propagate transaction block reservations Darrick J. Wong
2017-07-19 16:18 ` Brian Foster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox