Bug 1697605 - Fix 32-bit quota usage limit for RPC format
Summary: Fix 32-bit quota usage limit for RPC format
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: quota
Version: 7.6
Hardware: Unspecified
OS: Unspecified
Target Milestone: rc
: 7.8
Assignee: Petr Pisar
QA Contact: Maryna Nalbandian
Lenka Špačková
Depends On:
TreeView+ depends on / blocked
Reported: 2019-04-08 19:51 UTC by Frank Sorenson
Modified: 2020-06-04 14:13 UTC (History)
5 users (show)

Fixed In Version: quota-4.01-19.el7
Doc Type: Bug Fix
Doc Text:
.Setting disk quota limits over a network works again for users occupying more than 4 GB of space on the network file system Previously, the `setquota` utility was unable to handle an occupied space greater than 4 GB when communicating with an NFS server due to an incorrect format of the used disk size. Consequently, when setting disk quota limits for a user exceeding 4 GB of used space on a NFS-mounted file system, `setquota` failed to perform the operation. This update corrects the conversion of the used disk size to an RPC protocol format, and the described problem no longer occurs.
Clone Of:
Last Closed: 2019-08-06 12:44:02 UTC
Target Upstream Version:

Attachments (Terms of Use)

System ID Priority Status Summary Last Updated
Red Hat Knowledge Base (Solution) 5132291 None None None 2020-06-04 12:33:16 UTC
Red Hat Product Errata RHEA-2019:2093 None None None 2019-08-06 12:44:04 UTC

Description Frank Sorenson 2019-04-08 19:51:27 UTC
Description of problem:

The rpc quota format sets a limit on the maximum current usage at 4 GiB, due to using a 32-bit-unsigned value.

Upstream patch exists to fix this issue.

Version-Release number of selected component (if applicable):


How reproducible:

easy, see below

Steps to Reproduce:

make a user's current usage greater than 4 GiB:
 on the server:
  # truncate -s 10G /var/tmp/test_fs.img
  # mkfs -t xfs /var/tmp/test_fs.img
  # mkdir -p /mnt/export
  # mount -oloop,usrquota /var/tmp/test_fs.img /mnt/export
  # exportfs '*:/mnt/export
  # touch /mnt/export/testfile
  # chown user1 /mnt/export/testfile
  # dd if=/dev/zero of=/mnt/export/testfile bs=1M count=4100

 on the client:
  # mount server:/mnt/export /mnt/server
  # setquota -F rpc -r -u user1 100M 200M 0 0 /mnt/server

Actual results:

  # setquota -F rpc -r -u user1 100M 200M 0 0 /mnt/server
  setquota: Trying to set quota usage out of range supported by quota format on server:/mnt/export.
  setquota: Cannot write quota for 501 on server:/mnt/export: Numerical result out of range

Expected results:

quota set without error
  # setquota -F rpc -r -u user1 100M 200M 0 0 /mnt/server

Additional info:

due to the incorrect maximum, the test in check_dquot_range fails:

int check_dquot_range(struct dquot *dquot)
        if (dquot->dq_dqb.dqb_curinodes > info->dqi_max_i_usage ||
            dquot->dq_dqb.dqb_curspace > info->dqi_max_b_usage) {
                errstr(_("Trying to set quota usage out of range "
                         "supported by quota format on %s.\n"), dquot->dq_h->qh_quotadev);
                return -1;

both of these tests must be false in order for the range to be valid:
  	(dquot->dq_dqb.dqb_curspace = 4831772672) > (info->dqi_max_b_usage = 4294966272): FAIL
  	dquot->dq_dqb.dqb_curinodeo = 2) > (info->dqi_max_i_usage = 4294967295): PASS

upstream commit - 

From d7694c952073bf2ebb852014d9f979b5e3e7c018 Mon Sep 17 00:00:00 2001
From: Jan Kara <jack@suse.cz>
Date: Mon, 28 May 2018 18:08:24 +0200
Subject: [PATCH] rpc: Fix wrong limit for space usage
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Limit of maximum allowable space usage for RPC transfer was wrongly set
to ~4GB instead of ~4TB due to overflow in constant initialization. Fix

Signed-off-by: Jan Kara <jack@suse.cz>
Signed-off-by: Petr Písař <ppisar@redhat.com>
 quotaio_rpc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/quotaio_rpc.c b/quotaio_rpc.c
index 6f25144..edc1e9f 100644
--- a/quotaio_rpc.c
+++ b/quotaio_rpc.c
@@ -33,7 +33,8 @@ static int rpc_init_io(struct quota_handle *h)
 #ifdef RPC
        h->qh_info.dqi_max_b_limit = ~(uint32_t)0;
        h->qh_info.dqi_max_i_limit = ~(uint32_t)0;
-       h->qh_info.dqi_max_b_usage = (~(uint32_t)0) << QUOTABLOCK_BITS;
+       h->qh_info.dqi_max_b_usage = ((uint64_t)(~(uint32_t)0))
+                                                        << QUOTABLOCK_BITS;
        h->qh_info.dqi_max_i_usage = ~(uint32_t)0;
        return 0;

Comment 2 Petr Pisar 2019-04-09 08:18:00 UTC
Thank you for the report. I confirm the issue exists in RHEL 7 and that the patch fixes it.

Comment 11 errata-xmlrpc 2019-08-06 12:44:02 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.


Note You need to log in before you can comment on or make changes to this bug.