Fix regression [xfstests generic/327]

Resolves: RHEL-50644
Signed-off-by: Pavel Reichl <preichl@redhat.com>
This commit is contained in:
Pavel Reichl 2024-07-27 01:10:17 +02:00
parent 0286bbb974
commit 37a901be5a
3 changed files with 112 additions and 4 deletions

View File

@ -0,0 +1,36 @@
From dba8c5ca95516b9550fc44b2a476ceca60ee4b38 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Tue, 7 May 2024 12:55:30 +0200
Subject: [PATCH] quotaio_xfs: Fix error handling in xfs_read_dquot()
When quotactl(2) fails, xfs_read_dquot() will happily return zero-filled
structure. This is fine when the user structure does not exist but it is
wrong when there's other error (like EACCESS). Fix the error handling.
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Pavel Reichl <preichl@redhat.com>
---
quotaio_xfs.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index d742f9c..040e7d8 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -176,7 +176,12 @@ static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id)
qcmd = QCMD(Q_XFS_GETQUOTA, h->qh_type);
if (do_quotactl(qcmd, h->qh_quotadev, h->qh_dir,
id, (void *)&xdqblk) < 0) {
- ;
+ /*
+ * ENOENT means the structure just does not exist - return all
+ * zeros. Otherwise return failure.
+ */
+ if (errno != ENOENT)
+ return NULL;
}
else {
xfs_kern2utildqblk(&dquot->dq_dqb, &xdqblk);
--
2.45.2

View File

@ -0,0 +1,64 @@
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

View File

@ -13,7 +13,7 @@
Name: quota
Epoch: 1
Version: 4.09
Release: 1%{?dist}
Release: 2%{?dist}
Summary: System administration tools for monitoring users' disk usage
# quota_nld.c, quotaio_xfs.h: GPLv2
# bylabel.c copied from util-linux: GPLv2+
@ -59,9 +59,11 @@ Source4: rpc-rquotad.sysconfig
Patch0: quota-4.06-warnquota-configuration-tunes.patch
# Fix parsing a TCP port number
Patch1: quota-4.03-Validate-upper-bound-of-RPC-port.patch
Patch2: quota-4.10-Rename-searched_dir-sd_dir-to-sd_isdir.patch
Patch3: quota-4.10-Add-quotactl_fd-support.patch
Patch4: quota-4.10-Enable-support-for-tmpfs-quotas.patch
Patch2: quota-4.10-Rename-searched_dir-sd_dir-to-sd_isdir.patch
Patch3: quota-4.10-Add-quotactl_fd-support.patch
Patch4: quota-4.10-Enable-support-for-tmpfs-quotas.patch
Patch5: quota-4.10-quotaio_xfs-Fix-error-handling-in-xfs_read_dquot.patch
Patch6: quota-4.10-quotaio_xfs-Fix-quota-tools-on-XFS.patch
BuildRequires: autoconf
BuildRequires: automake
@ -188,6 +190,8 @@ Linux/UNIX environment.
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
# Regenerate build scripts
autoreconf -f -i
@ -337,6 +341,10 @@ make check
%changelog
* Fri Jul 26 2024 Pavel Reichl <preichl@redhat.com> - 1:4.09-2
- Fix regression
- Related: RHEL-50644
* Mon Jun 10 2024 Pavel Reichl <preichl@redhat.com> - 1:4.09-1
- Update to new upstream version
- Add tmpfs quota support