You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
quota/SOURCES/quota-4.10-quotaio_xfs-Fix-...

65 lines
2.1 KiB

From bd13b74e6d181638023d8a89316417643d9e7fd8 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 7 May 2024 14:21:45 +0200
Subject: [PATCH] quotaio_xfs: Fix quota-tools on XFS
Patches implementing tmpfs quota support, commit 00534e79856c ("Enable
support for tmpfs quotas") in particular, broke quota-tools on XFS
because quotactl(2) syscall got called with wrong arguments. Fix it.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Pavel Reichl <preichl@redhat.com>
---
quotaio_xfs.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index 040e7d8..c10534d 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -124,11 +124,9 @@ static inline int xfs_util2kerndqblk(struct xfs_kern_dqblk *k, struct util_dqblk
static int xfs_init_io(struct quota_handle *h)
{
struct xfs_mem_dqinfo info;
- int qcmd;
- qcmd = QCMD(Q_XFS_GETQSTAT, h->qh_type);
memset(&info, 0, sizeof(struct xfs_mem_dqinfo));
- if (quotactl_handle(qcmd, h, 0, (void *)&info) < 0)
+ if (quotactl_handle(Q_XFS_GETQSTAT, h, 0, (void *)&info) < 0)
return -1;
h->qh_info.dqi_bgrace = info.qs_btimelimit;
h->qh_info.dqi_igrace = info.qs_itimelimit;
@@ -142,7 +140,6 @@ static int xfs_init_io(struct quota_handle *h)
static int xfs_write_info(struct quota_handle *h)
{
struct xfs_kern_dqblk xdqblk;
- int qcmd;
if (!XFS_USRQUOTA(h) && !XFS_GRPQUOTA(h) && !XFS_PRJQUOTA(h))
return 0;
@@ -152,8 +149,7 @@ static int xfs_write_info(struct quota_handle *h)
xdqblk.d_btimer = h->qh_info.dqi_bgrace;
xdqblk.d_itimer = h->qh_info.dqi_igrace;
xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
- qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
- if (quotactl_handle(qcmd, h, 0, (void *)&xdqblk) < 0)
+ if (quotactl_handle(Q_XFS_SETQLIM, h, 0, (void *)&xdqblk) < 0)
return -1;
return 0;
}
@@ -180,8 +176,9 @@ static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id)
* ENOENT means the structure just does not exist - return all
* zeros. Otherwise return failure.
*/
- if (errno != ENOENT)
+ if (errno != ENOENT) {
return NULL;
+ }
}
else {
xfs_kern2utildqblk(&dquot->dq_dqb, &xdqblk);
--
2.45.2