From: Gao Xiang <hsiangkao@linux.alibaba.com>
To: "Darrick J. Wong" <djwong@kernel.org>,
Dave Chinner <david@fromorbit.com>
Cc: xfs <linux-xfs@vger.kernel.org>
Subject: Re: [PATCH] xfs: don't deplete the reserve pool when trying to shrink the fs
Date: Tue, 23 May 2023 13:05:31 +0800 [thread overview]
Message-ID: <4dd84200-54e2-8cdc-6816-38aed9dada2c@linux.alibaba.com> (raw)
In-Reply-To: <20230523044646.GB11594@frogsfrogsfrogs>
On 2023/5/23 21:46, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
>
> Every now and then, xfs/168 fails with this logged in dmesg:
>
> Reserve blocks depleted! Consider increasing reserve pool size.
> EXPERIMENTAL online shrink feature in use. Use at your own risk!
> Per-AG reservation for AG 1 failed. Filesystem may run out of space.
> Per-AG reservation for AG 1 failed. Filesystem may run out of space.
> Error -28 reserving per-AG metadata reserve pool.
> Corruption of in-memory data (0x8) detected at xfs_ag_shrink_space+0x23c/0x3b0 [xfs] (fs/xfs/libxfs/xfs_ag.c:1007). Shutting down filesystem.
>
> It's silly to deplete the reserved blocks pool just to shrink the
> filesystem, particularly since the fs goes down after that.
>
> Fixes: fb2fc1720185 ("xfs: support shrinking unused space in the last AG")
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
[ These months I have no more slots for XFS, will go back later
after some ongoing feature development is done. ]
Thanks,
Gao Xiang
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>
> ---
> fs/xfs/xfs_fsops.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c
> index 13851c0d640b..5f00527b8065 100644
> --- a/fs/xfs/xfs_fsops.c
> +++ b/fs/xfs/xfs_fsops.c
> @@ -140,9 +140,13 @@ xfs_growfs_data_private(
> return -EINVAL;
> }
>
> - error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata,
> - (delta > 0 ? XFS_GROWFS_SPACE_RES(mp) : -delta), 0,
> - XFS_TRANS_RESERVE, &tp);
> + if (delta > 0)
> + error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata,
> + XFS_GROWFS_SPACE_RES(mp), 0, XFS_TRANS_RESERVE,
> + &tp);
> + else
> + error = xfs_trans_alloc(mp, &M_RES(mp)->tr_growdata, -delta, 0,
> + 0, &tp);
> if (error)
> return error;
>
prev parent reply other threads:[~2023-05-23 5:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-23 4:46 [PATCH] xfs: don't deplete the reserve pool when trying to shrink the fs Darrick J. Wong
2023-05-23 5:05 ` Gao Xiang [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=4dd84200-54e2-8cdc-6816-38aed9dada2c@linux.alibaba.com \
--to=hsiangkao@linux.alibaba.com \
--cc=david@fromorbit.com \
--cc=djwong@kernel.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