Skip to contentSkip to conversation

quota: allow users to truncate group and project quota files

PATCH In review Darrick J. Wong 2 participants 4 messages Jul 28, 2021 – Jul 29, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quota: allow users to truncate group and project quota files

From: Darrick J. Wong <[email protected]>

In commit 79ac1ae4, I /think/ xfsprogs gained the ability to deal with project or group quotas. For some reason, the quota remove command was structured so that if the user passes both -g and -p, it will only ask the kernel truncate the group quota file. This is a strange behavior since -ug results in truncation requests for both user and group quota files, and the kernel is smart enough to return 0 if asked to truncate a quota file that doesn't exist.

In other words, this is a seemingly arbitrary limitation of the command. It's an unexpected behavior since we don't do any sort of parameter validation to warn users when -p is silently ignored. Modern V5 filesystems support both group and project quotas, so it's all the more surprising that you can't do group and project all at once. Remove this pointless restriction.

Found while triaging xfs/007 regressions.

Fixes 79ac1ae4 ("Fix xfs_quota disable, enable, off and remove commands Merge of master-melb:xfs-cmds:29395a by kenmcd.")
---
 quota/state.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
quota/state.c +2 -1
index 3ffb2c88..43fb700f 100644
@@ -463,7 +463,8 @@ remove_extents(
 	if (type & XFS_GROUP_QUOTA) {
 		if (remove_qtype_extents(dir, XFS_GROUP_QUOTA) < 0)
 			return;
-	} else if (type & XFS_PROJ_QUOTA) {
+	}
+	if (type & XFS_PROJ_QUOTA) {
 		if (remove_qtype_extents(dir, XFS_PROJ_QUOTA) < 0)
 			return;
 	}
#1 lore raw

Eric asked me to resend all the pending patches for 5.13, so I might as well NAK this and tell everyone to watch for the imminent patchbomb.

--D

Quoted 39 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

In commit 79ac1ae4, I /think/ xfsprogs gained the ability to deal with project or group quotas. For some reason, the quota remove command was structured so that if the user passes both -g and -p, it will only ask the kernel truncate the group quota file. This is a strange behavior since -ug results in truncation requests for both user and group quota files, and the kernel is smart enough to return 0 if asked to truncate a quota file that doesn't exist.

In other words, this is a seemingly arbitrary limitation of the command. It's an unexpected behavior since we don't do any sort of parameter validation to warn users when -p is silently ignored. Modern V5 filesystems support both group and project quotas, so it's all the more surprising that you can't do group and project all at once. Remove this pointless restriction.

Found while triaging xfs/007 regressions.

Fixes 79ac1ae4 ("Fix xfs_quota disable, enable, off and remove commands Merge of master-melb:xfs-cmds:29395a by kenmcd.")
---
 quota/state.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
quota/state.c +2 -1
index 3ffb2c88..43fb700f 100644
@@ -463,7 +463,8 @@ remove_extents(
 	if (type & XFS_GROUP_QUOTA) {
 		if (remove_qtype_extents(dir, XFS_GROUP_QUOTA) < 0)
 			return;
-	} else if (type & XFS_PROJ_QUOTA) {
+	}
+	if (type & XFS_PROJ_QUOTA) {
 		if (remove_qtype_extents(dir, XFS_PROJ_QUOTA) < 0)
 			return;
 	}
#2 lore raw
Quoted 2 lines · Darrick J. Wong

Eric asked me to resend all the pending patches for 5.13, so I might as well NAK this and tell everyone to watch for the imminent patchbomb.

oh, I'll read the whole thread before reviewing next time, but well, feel free to carry my reviewed-by.

Cheers

Quoted 44 lines

--D

Quoted 39 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

In commit 79ac1ae4, I /think/ xfsprogs gained the ability to deal with project or group quotas. For some reason, the quota remove command was structured so that if the user passes both -g and -p, it will only ask the kernel truncate the group quota file. This is a strange behavior since -ug results in truncation requests for both user and group quota files, and the kernel is smart enough to return 0 if asked to truncate a quota file that doesn't exist.

In other words, this is a seemingly arbitrary limitation of the command. It's an unexpected behavior since we don't do any sort of parameter validation to warn users when -p is silently ignored. Modern V5 filesystems support both group and project quotas, so it's all the more surprising that you can't do group and project all at once. Remove this pointless restriction.

Found while triaging xfs/007 regressions.

Fixes 79ac1ae4 ("Fix xfs_quota disable, enable, off and remove commands Merge of master-melb:xfs-cmds:29395a by kenmcd.")
---
 quota/state.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
quota/state.c +2 -1
index 3ffb2c88..43fb700f 100644
@@ -463,7 +463,8 @@ remove_extents(
 	if (type & XFS_GROUP_QUOTA) {
 		if (remove_qtype_extents(dir, XFS_GROUP_QUOTA) < 0)
 			return;
-	} else if (type & XFS_PROJ_QUOTA) {
+	}
+	if (type & XFS_PROJ_QUOTA) {
 		if (remove_qtype_extents(dir, XFS_PROJ_QUOTA) < 0)
 			return;
 	}
Signature · 1 line
Carlos
Reviewed-by on v1 1/1
#3 lore raw
In reply to Darrick J. Wong
Quoted 17 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

In commit 79ac1ae4, I /think/ xfsprogs gained the ability to deal with project or group quotas. For some reason, the quota remove command was structured so that if the user passes both -g and -p, it will only ask the kernel truncate the group quota file. This is a strange behavior since -ug results in truncation requests for both user and group quota files, and the kernel is smart enough to return 0 if asked to truncate a quota file that doesn't exist.

In other words, this is a seemingly arbitrary limitation of the command. It's an unexpected behavior since we don't do any sort of parameter validation to warn users when -p is silently ignored. Modern V5 filesystems support both group and project quotas, so it's all the more surprising that you can't do group and project all at once. Remove this pointless restriction.

Quoted 4 lines

Found while triaging xfs/007 regressions.

Fixes 79ac1ae4 ("Fix xfs_quota disable, enable, off and remove commands Merge of master-melb:xfs-cmds:29395a by kenmcd.")

Looks good.

Quoted 19 lines
---
 quota/state.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
quota/state.c +2 -1
index 3ffb2c88..43fb700f 100644
@@ -463,7 +463,8 @@ remove_extents(
 	if (type & XFS_GROUP_QUOTA) {
 		if (remove_qtype_extents(dir, XFS_GROUP_QUOTA) < 0)
 			return;
-	} else if (type & XFS_PROJ_QUOTA) {
+	}
+	if (type & XFS_PROJ_QUOTA) {
 		if (remove_qtype_extents(dir, XFS_PROJ_QUOTA) < 0)
 			return;
 	}
Signature · 1 line
Carlos