Fix setting individual limits for XFS

This commit is contained in:
Petr Písař 2020-08-24 10:01:42 +02:00
parent ba1d88bcb7
commit a6ce046f13
4 changed files with 90 additions and 68 deletions

View File

@ -0,0 +1,42 @@
From 13bb8c2daca0f1c1099ce6ba9dcb23319f7955d0 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Wed, 20 May 2020 16:22:52 +0200
Subject: [PATCH 2/2] Fix limits setting on XFS filesystem
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
xfs_commit_dquot() always set FS_DQ_LIMIT_MASK when calling
Q_XFS_SETQLIM. So far this wasn't a problem since quota tools didn't
support setting of anything else for XFS but now that kernel will start
supporting setting of grace times for XFS, we need to be more careful
and set limits bits only if we really want to update them. Also
FS_DQ_LIMIT_MASK contains real-time limits as well. Quota tools
currently don't support them in any way so avoid telling kernel to set
them.
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaio_xfs.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index a4d6f67..3333bb1 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -165,7 +165,9 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
if (flags & COMMIT_USAGE) /* block usage */
xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
} else {
- xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
+ if (flags & COMMIT_LIMITS) /* warn/limit */
+ xdqblk.d_fieldmask |= FS_DQ_BSOFT | FS_DQ_BHARD |
+ FS_DQ_ISOFT | FS_DQ_IHARD;
if (flags & COMMIT_TIMES) /* indiv grace period */
xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
}
--
2.25.4

View File

@ -0,0 +1,39 @@
From be96da2353669d433b0abddb85b26ccaf35e3451 Mon Sep 17 00:00:00 2001
From: Eric Sandeen <sandeen@redhat.com>
Date: Thu, 14 May 2020 12:17:29 +0200
Subject: [PATCH 1/2] quota-tools: Set FS_DQ_TIMER_MASK for individual xfs
grace times
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
xfs quota code doesn't currently allow increasing an individual
user's grace time, but kernel patches are in development for this.
In order for setquota to be able to send this update via
setquota -T, we need to add the FS_DQ_TIMER_MASK when we are trying
to update the grace times on an individual user's dquot.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
quotaio_xfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index b22c7b4..a4d6f67 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -166,6 +166,8 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
} else {
xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
+ if (flags & COMMIT_TIMES) /* indiv grace period */
+ xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
}
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);
--
2.25.4

View File

@ -1,65 +0,0 @@
From sandeen@redhat.com Thu May 14 05:45:33 2020
Return-Path: sandeen@redhat.com
Received: from zmta04.collab.prod.int.phx2.redhat.com (LHLO
zmta04.collab.prod.int.phx2.redhat.com) (10.5.81.11) by
zmail20.collab.prod.int.phx2.redhat.com with LMTP; Wed, 13 May 2020
23:45:33 -0400 (EDT)
Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23])
by zmta04.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 5C7F0D1826
for <ppisar@mail.corp.redhat.com>; Wed, 13 May 2020 23:45:33 -0400 (EDT)
Received: by smtp.corp.redhat.com (Postfix)
id 588842E179; Thu, 14 May 2020 03:45:33 +0000 (UTC)
Delivered-To: ppisar@redhat.com
Received: from [IPv6:::1] (ovpn04.gateway.prod.ext.phx2.redhat.com [10.5.9.4])
by smtp.corp.redhat.com (Postfix) with ESMTPS id 012132E174;
Thu, 14 May 2020 03:45:32 +0000 (UTC)
To: Jan Kara <jack@suse.cz>, linux-xfs <linux-xfs@vger.kernel.org>
Cc: =?UTF-8?B?UGV0ciBQw61zYcWZ?= <ppisar@redhat.com>
From: Eric Sandeen <sandeen@redhat.com>
Subject: [PATCH] quota-tools: Set FS_DQ_TIMER_MASK for individual xfs grace
times
Message-ID: <72a454f1-c2ee-b777-90db-6bdfd4a8572c@redhat.com>
Date: Wed, 13 May 2020 22:45:32 -0500
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:68.0)
Gecko/20100101 Thunderbird/68.8.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Language: en-US
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23
Status: RO
Content-Length: 1147
Lines: 31
xfs quota code doesn't currently allow increasing an individual
user's grace time, but kernel patches are in development for this.
In order for setquota to be able to send this update via
setquota -T, we need to add the FS_DQ_TIMER_MASK when we are trying
to update the grace times on an individual user's dquot.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
I wonder if we should only be setting the LIMIT_MASK only if
(flags & COMMIT_LIMITS), but it doesn't seem to be a problem and
is unrelated to this change I'm leaving it alone for now, though if
anyone thinks it's better I can update the patch.
I'm putting together xfstests cases for this, if you want to wait
for those, that's fine. Thanks!
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index b22c7b4..a4d6f67 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -166,6 +166,8 @@ static int xfs_commit_dquot(struct dquot *dquot, int flags)
xdqblk.d_fieldmask |= FS_DQ_BCOUNT;
} else {
xdqblk.d_fieldmask |= FS_DQ_LIMIT_MASK;
+ if (flags & COMMIT_TIMES) /* indiv grace period */
+ xdqblk.d_fieldmask |= FS_DQ_TIMER_MASK;
}
qcmd = QCMD(Q_XFS_SETQLIM, h->qh_type);

View File

@ -13,7 +13,7 @@
Name: quota
Epoch: 1
Version: 4.05
Release: 14%{?dist}
Release: 15%{?dist}
Summary: System administration tools for monitoring users' disk usage
# quota_nld.c, quotaio_xfs.h: GPLv2
# bylabel.c copied from util-linux: GPLv2+
@ -104,8 +104,10 @@ Patch17: quota-4.05-warnquota-Initialize-all-members-of-a-configparams-s.patch
Patch18: quota-4.05-Fix-ignoring-disabled-quotas.patch
# Pass quota type for Q_XFS_GETQSTAT, in upstream after 4.05
Patch19: quota-4.05-quota-tools-pass-quota-type-to-QCMD-for-Q_XFS_GETQST.patch
# Set kernel option when setting XFS grace times, posted to upstream
Patch20: quota-4.05-quota-tools-Set-FS_DQ_TIMER_MASK-for-individual-xfs-grace-times.patch
# 1/2 Support setting individual grace times for XFS, in upstream after 4.05
Patch20: quota-4.05-quota-tools-Set-FS_DQ_TIMER_MASK-for-individual-xfs-.patch
# 2/2 Support setting individual grace times for XFS, in upstream after 4.05
Patch21: quota-4.05-Fix-limits-setting-on-XFS-filesystem.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: bash
@ -246,6 +248,7 @@ Linux/UNIX environment.
%patch18 -p1
%patch19 -p1
%patch20 -p1
%patch21 -p1
# Regenerate build scripts
autoreconf -f -i
@ -395,6 +398,9 @@ make check
%changelog
* Mon Aug 24 2020 Petr Pisar <ppisar@redhat.com> - 1:4.05-15
- Fix setting individual limits for XFS
* Sat Aug 01 2020 Fedora Release Engineering <releng@fedoraproject.org> - 1:4.05-14
- Second attempt - Rebuilt for
https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild