Skip to contentSkip to conversation

quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT

PATCH In review Eric Sandeen 2 participants 2 messages May 8, 2020 – May 13, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 quota-tools: pass quota type to QCMD for Q_XFS_GETQSTAT

Older kernels ignored the type sent to Q_XFS_GETQSTAT, and returned timer information for the first quota type which was found to be enabled.

As of 555b2c3da1fc ("quota: honor quota type in Q_XGETQSTAT[V] calls") the kernel now honors the quota type requested, so send that from the Q_XFS_GETQSTAT calls in quota tools.

Older kernels ignore the type altogether, so this change should be backwards compatible with no change in behavior.

---

quotaio_xfs.c +1 -1
index 56daf89..b22c7b4 100644
@@ -81,7 +81,7 @@ static int xfs_init_io(struct quota_handle *h)
 	struct xfs_mem_dqinfo info;
 	int qcmd;
 
-	qcmd = QCMD(Q_XFS_GETQSTAT, 0);
+	qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
 	memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
 	if (quotactl(qcmd, h->qh_quotadev, 0, (void *)&info) < 0)
 		return -1;
quotaon_xfs.c +1 -1
index d557a75..d137240 100644
@@ -32,7 +32,7 @@ static int xfs_state_check(int qcmd, int type, int flags, const char *dev, int r
 	if (flags & STATEFLAG_ALL)
 		return 0;	/* noop */
 
-	if (quotactl(QCMD(Q_XFS_GETQSTAT, 0), dev, 0, (void *)&info) < 0) {
+	if (quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info) < 0) {
 		errstr(_("quotactl() on %s: %s\n"), dev, strerror(errno));
 		return -1;
 	}
#1 lore raw
Quoted 4 lines · Eric Sandeen

Older kernels ignored the type sent to Q_XFS_GETQSTAT, and returned timer information for the first quota type which was found to be enabled.

Quoted 8 lines

As of 555b2c3da1fc ("quota: honor quota type in Q_XGETQSTAT[V] calls") the kernel now honors the quota type requested, so send that from the Q_XFS_GETQSTAT calls in quota tools.

Older kernels ignore the type altogether, so this change should be backwards compatible with no change in behavior.

Thanks for the patch. I've added it to my tree.

Honza

Quoted 29 lines

---

quotaio_xfs.c +1 -1
index 56daf89..b22c7b4 100644
@@ -81,7 +81,7 @@ static int xfs_init_io(struct quota_handle *h)
 	struct xfs_mem_dqinfo info;
 	int qcmd;
 
-	qcmd = QCMD(Q_XFS_GETQSTAT, 0);
+	qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
 	memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
 	if (quotactl(qcmd, h->qh_quotadev, 0, (void *)&info) < 0)
 		return -1;
quotaon_xfs.c +1 -1
index d557a75..d137240 100644
@@ -32,7 +32,7 @@ static int xfs_state_check(int qcmd, int type, int flags, const char *dev, int r
 	if (flags & STATEFLAG_ALL)
 		return 0;	/* noop */
 
-	if (quotactl(QCMD(Q_XFS_GETQSTAT, 0), dev, 0, (void *)&info) < 0) {
+	if (quotactl(QCMD(Q_XFS_GETQSTAT, type), dev, 0, (void *)&info) < 0) {
 		errstr(_("quotactl() on %s: %s\n"), dev, strerror(errno));
 		return -1;
 	}
Signature · 2 lines
Jan Kara <[email protected]>
SUSE Labs, CR