diff mbox series

[1/4] xfs_repair: don't recreate /quota metadir if there are no quota inodes

Message ID 174257453614.474645.7529877430708333135.stgit@frogsfrogsfrogs (mailing list archive)
State New
Headers show
Series [1/4] xfs_repair: don't recreate /quota metadir if there are no quota inodes | expand

Commit Message

Darrick J. Wong March 21, 2025, 4:31 p.m. UTC
From: Darrick J. Wong <djwong@kernel.org>

If repair does not discover even a single quota file, then don't have it
try to create a /quota metadir to hold them.  This avoids pointless
repair failures on quota-less filesystems that are nearly full.

Found via generic/558 on a zoned=1 filesystem.

Cc: <linux-xfs@vger.kernel.org> # v6.13.0
Fixes: b790ab2a303d58 ("xfs_repair: support quota inodes in the metadata directory")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
 repair/phase6.c |    5 +++++
 1 file changed, 5 insertions(+)

Comments

Andrey Albershteyn March 21, 2025, 5:58 p.m. UTC | #1
On 2025-03-21 09:31:31, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> If repair does not discover even a single quota file, then don't have it
> try to create a /quota metadir to hold them.  This avoids pointless
> repair failures on quota-less filesystems that are nearly full.
> 
> Found via generic/558 on a zoned=1 filesystem.
> 
> Cc: <linux-xfs@vger.kernel.org> # v6.13.0
> Fixes: b790ab2a303d58 ("xfs_repair: support quota inodes in the metadata directory")
> Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
> ---
>  repair/phase6.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> 
> diff --git a/repair/phase6.c b/repair/phase6.c
> index 4064a84b24509f..2d526dda484293 100644
> --- a/repair/phase6.c
> +++ b/repair/phase6.c
> @@ -3538,6 +3538,11 @@ reset_quota_metadir_inodes(
>  	struct xfs_inode	*dp = NULL;
>  	int			error;
>  
> +	if (!has_quota_inode(XFS_DQTYPE_USER) &&
> +	    !has_quota_inode(XFS_DQTYPE_GROUP) &&
> +	    !has_quota_inode(XFS_DQTYPE_PROJ))
> +		return;
> +
>  	error = -libxfs_dqinode_mkdir_parent(mp, &dp);
>  	if (error)
>  		do_error(_("failed to create quota metadir (%d)\n"),
> 

LGTM
Reviewed-by: Andrey Albershteyn <aalbersh@kernel.org>
Christoph Hellwig March 23, 2025, 6:33 a.m. UTC | #2
On Fri, Mar 21, 2025 at 09:31:31AM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> If repair does not discover even a single quota file, then don't have it
> try to create a /quota metadir to hold them.  This avoids pointless
> repair failures on quota-less filesystems that are nearly full.
> 
> Found via generic/558 on a zoned=1 filesystem.

Interesting, I never saw that fail.  Any interesting options you had
to inject for that?

The patch itself looks fine, though:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Darrick J. Wong March 25, 2025, 12:54 a.m. UTC | #3
On Sat, Mar 22, 2025 at 11:33:42PM -0700, Christoph Hellwig wrote:
> On Fri, Mar 21, 2025 at 09:31:31AM -0700, Darrick J. Wong wrote:
> > From: Darrick J. Wong <djwong@kernel.org>
> > 
> > If repair does not discover even a single quota file, then don't have it
> > try to create a /quota metadir to hold them.  This avoids pointless
> > repair failures on quota-less filesystems that are nearly full.
> > 
> > Found via generic/558 on a zoned=1 filesystem.
> 
> Interesting, I never saw that fail.  Any interesting options you had
> to inject for that?

No, just use a pathetically small device to try to pound on ENOSPC
harder. ;)

--D

> The patch itself looks fine, though:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> 
>
diff mbox series

Patch

diff --git a/repair/phase6.c b/repair/phase6.c
index 4064a84b24509f..2d526dda484293 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -3538,6 +3538,11 @@  reset_quota_metadir_inodes(
 	struct xfs_inode	*dp = NULL;
 	int			error;
 
+	if (!has_quota_inode(XFS_DQTYPE_USER) &&
+	    !has_quota_inode(XFS_DQTYPE_GROUP) &&
+	    !has_quota_inode(XFS_DQTYPE_PROJ))
+		return;
+
 	error = -libxfs_dqinode_mkdir_parent(mp, &dp);
 	if (error)
 		do_error(_("failed to create quota metadir (%d)\n"),